Class RepositoryBase
The base repository that all repositories should inherit from. Used for any I/O operations inside of VISAB. If you need to import any java IO libs in non repository classes, you are likely doing it wrong. Create a specific repository instead or check if there isnt a repositry implementation that supports your wanted functionality already.
Inheritance
java.lang.Object
RepositoryBase
Inherited Members
java.lang.Object.clone()
java.lang.Object.equals(java.lang.Object)
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.hashCode()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.toString()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)
Namespace:
Assembly: .dll
Syntax
public abstract class RepositoryBase implements IRepository
Constructors
RepositoryBase(String baseDirectory)
Declaration
public RepositoryBase(String baseDirectory)
Parameters
Type |
Name |
Description |
java.lang.String |
baseDirectory |
|
Fields
baseDirectory
Declaration
protected String baseDirectory
Field Value
Type |
Description |
java.lang.String |
|
Methods
combinePath(String path, String[] more)
Combines path strings to one string
Declaration
public String combinePath(String path, String[] more)
Parameters
Type |
Name |
Description |
java.lang.String |
path |
|
java.lang.String[] |
more |
|
Returns
Type |
Description |
java.lang.String |
|
createMissingDirectories(String filePath)
Creates missing directorie for a given file path
Declaration
public boolean createMissingDirectories(String filePath)
Parameters
Type |
Name |
Description |
java.lang.String |
filePath |
|
Returns
deleteFile(String filePath)
Deletes a file at a given path
Declaration
public boolean deleteFile(String filePath)
Parameters
Type |
Name |
Description |
java.lang.String |
filePath |
|
Returns
deleteFolder(File folder)
Recursively deletes a folder and all its contents
Declaration
public boolean deleteFolder(File folder)
Parameters
Type |
Name |
Description |
java.io.File |
folder |
|
Returns
getBaseDirectory()
Returns the path to the base directory.
Declaration
public String getBaseDirectory()
Returns
Type |
Description |
java.lang.String |
The base directory
|
loadFile(String filePath)
Reads in a file at a given path
Declaration
public File loadFile(String filePath)
Parameters
Type |
Name |
Description |
java.lang.String |
filePath |
|
Returns
Type |
Description |
java.io.File |
|
loadFileRelative(String relativePath)
[CONVENIENCE] Loads a file with a path relative to the base directory
Declaration
public File loadFileRelative(String relativePath)
Parameters
Type |
Name |
Description |
java.lang.String |
relativePath |
The relative path of the file
|
Returns
Type |
Description |
java.io.File |
The loaded file
|
readFileContents(String filePath)
Reads the contents of a file at a given path
Declaration
public String readFileContents(String filePath)
Parameters
Type |
Name |
Description |
java.lang.String |
filePath |
|
Returns
Type |
Description |
java.lang.String |
|
renameFile(String filePath, String newFilePath)
Renames a file at a given path to
Declaration
public boolean renameFile(String filePath, String newFilePath)
Parameters
Type |
Name |
Description |
java.lang.String |
filePath |
|
java.lang.String |
newFilePath |
|
Returns
writeToFile(String filePath, String content)
Writes string content to a file at a given path
Declaration
public boolean writeToFile(String filePath, String content)
Parameters
Type |
Name |
Description |
java.lang.String |
filePath |
|
java.lang.String |
content |
|
Returns
writeToFileRelative(String relativePath, String content)
[CONVENIENCE] Writes to a file with to a path relative to the base directory
Declaration
public boolean writeToFileRelative(String relativePath, String content)
Parameters
Type |
Name |
Description |
java.lang.String |
relativePath |
The relative path of the file
|
java.lang.String |
content |
The content to write to the file
|
Returns
Type |
Description |
boolean |
True if successfully saved
|
Implements