Interface Storage
- 
 public interface StorageStorage is a standard API that providers can implement to allow abstract UNIX-like file system for data sources. The methods provided by Storage are similar in form and behavior to standard Linux operating system commands.- A name pattern (file or directory) is a sequence of characters, not containing "/", leading spaces, trailing spaces.
- A name (file or directory name) is a name pattern, not containing "*" or "?".
- A pattern is a sequence of names separated with "/", optionally ending at a name pattern.
 <pattern> ::= <absolute pattern> | <relative pattern> <absolute path> ::= / [<relative pattern>] <relative path> ::= <name> {/ <name>} [/ <name pattern>] [/] | <name pattern> [/]
- A path is a path is a pattern, not containing any name pattern.
 - Even though the syntax allows patterns with trailing "/", they are treated as referring the same file or directory as the path without the trailing /
- This is an abstract file system abstracting the underlying physical file system if any. Thus, under Windows the directories separator is still /, no matter that Windows uses \
 - Author:
- Marko A. Rodriguez (http://markorodriguez.com)
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringFILE_SEPARATORThe file and directory names separator in this uniform UNIX-like abstract file systemstatic StringROOT_DIRECTORY
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancp(String sourcePattern, String targetDirectory)Recursively copy all the data sources from the source location to the target location.booleanexists(String pattern)Determine whether the specified location has a data source.default Iterator<String>head(String location)Get a string representation of the specified number of lines at the data source location.Iterator<String>head(String location, int totalLines)Get a string representation of the specified number of lines at the data source location.default Iterator<Vertex>head(String location, Class readerClass)Get the vertices at the specified graph location.Iterator<Vertex>head(String location, Class readerClass, int totalLines)Get the vertices at the specified graph location.default <K,V>
 Iterator<KeyValue<K,V>>head(String location, String memoryKey, Class readerClass)Get theKeyValuedata at the specified memory location.<K,V>
 Iterator<KeyValue<K,V>>head(String location, String memoryKey, Class readerClass, int totalLines)Get theKeyValuedata at the specified memory location.List<String>ls()List all the data sources in the root directory.List<String>ls(String pattern)List all the files (e.g.booleanrm(String pattern)Recursively remove the file (data source) at the specified location.static StringtoPath(File path)static StringtoPath(String path)
 
- 
- 
- 
Field Detail- 
FILE_SEPARATORstatic final String FILE_SEPARATOR The file and directory names separator in this uniform UNIX-like abstract file system- See Also:
- Constant Field Values
 
 - 
ROOT_DIRECTORYstatic final String ROOT_DIRECTORY - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
lsList<String> ls() List all the data sources in the root directory.- Returns:
- non-null list of files (data sources) and directories in the root directory (/)
- See Also:
- ls(String)
 
 - 
lsList<String> ls(String pattern) List all the files (e.g. data sources) and directories matching the location pattern.- Parameters:
- pattern- non-null pattern specifying a set of files and directories. Cases:- a path to a file - specifies a single file to list
- a path to a directory - specifies all files and directories immediately nested in that directory to list
- pattern - specifies a set of files and directories to list
- / - specifies the root directory to list its contents
 
- Returns:
- non-null list of files (data sources) and directories matching the pattern.
 
 - 
cpboolean cp(String sourcePattern, String targetDirectory) Recursively copy all the data sources from the source location to the target location.- Parameters:
- sourcePattern- non-null pattern specifying a set of files and directories. Cases:- a path to a file - specifies a single file
- a path to a directory - specifies all files and directories nested (recursively) in that directory
- pattern - specifies a set of files and directories
- / - specifies the contents of the root directory (recursively)
 
- targetDirectory- non-null directory where to copy to
- Returns:
- whether data sources were copied
 
 - 
existsboolean exists(String pattern) Determine whether the specified location has a data source.- Parameters:
- pattern- non-null pattern specifying a set of files and directories. Examples:- a path to a file - specifies a single file
- a path to a directory - specifies the contents of that directory as all files and directories immediately nested in it
- pattern - specifies a set of files and directories
- / - specifies the immediate contents of the root directory
 
- Returns:
- true if the pattern specifies a non-empty set of files and directories
 
 - 
rmboolean rm(String pattern) Recursively remove the file (data source) at the specified location. NOTE: Some implementations derive the notion of the containing directory from the presence of the file, so removing all files from a directory in those implementations removes also their directory.- Parameters:
- pattern- non-null pattern specifying a set of files and directories. Examples:- a path to a file - specifies a single file
- a path to a directory - specifies that directory and all files and directories recursively nested in it
- pattern - specifies a set of files and directories
- / - specifies the root directory
 
- Returns:
- true if all specified files and directories were removed
 
 - 
headdefault Iterator<String> head(String location) Get a string representation of the specified number of lines at the data source location.- Parameters:
- location- the data source location
- Returns:
- an iterator of lines
 
 - 
headIterator<String> head(String location, int totalLines) Get a string representation of the specified number of lines at the data source location.- Parameters:
- location- the data source location
- totalLines- the total number of lines to retrieve
- Returns:
- an iterator of lines.
 
 - 
headIterator<Vertex> head(String location, Class readerClass, int totalLines) Get the vertices at the specified graph location.- Parameters:
- location- the location of the graph (or the root location and search will be made)
- readerClass- the class of the parser that understands the graph format
- totalLines- the total number of lines of the graph to return
- Returns:
- an iterator of vertices.
 
 - 
headdefault Iterator<Vertex> head(String location, Class readerClass) Get the vertices at the specified graph location.- Parameters:
- location- the location of the graph (or the root location and search will be made)
- readerClass- the class of the parser that understands the graph format
- Returns:
- an iterator of vertices.
 
 - 
head<K,V> Iterator<KeyValue<K,V>> head(String location, String memoryKey, Class readerClass, int totalLines) Get theKeyValuedata at the specified memory location.- Parameters:
- location- the root location of the data
- memoryKey- the memory key
- readerClass- the class of the parser that understands the memory format
- totalLines- the total number of key-values to return
- Returns:
- an iterator of key-values.
 
 - 
headdefault <K,V> Iterator<KeyValue<K,V>> head(String location, String memoryKey, Class readerClass) Get theKeyValuedata at the specified memory location.- Parameters:
- location- the root location of the data
- memoryKey- the memory key
- readerClass- the class of the parser that understands the memory format
- Returns:
- an iterator of key-values.
 
 - 
toPathstatic String toPath(File path) - Parameters:
- path- non-null local file path
- Returns:
- non-null, not empty path in the Storagefile system.
 
 
- 
 
-