org.das2.util.filesystem.FileSystem
Filesystems provide an abstraction layer so that clients can access
any hierarchy of files in a implementation-independent way. For example,
remote filesystems accessible via HTTP are accessible through the same
interface as a local filesystem.
PROP_CASE_INSENSITIVE
Boolean.TRUE if the filesystem ignores case, such as Windows local filesystem.
NULL
result from failed listing, etc.
create
Deprecated: use create( URI root ) instead.
create( String s ) → org.das2.util.filesystem.FileSystem
create( String s, ProgressMonitor mon ) → org.das2.util.filesystem.FileSystem
create( java.net.URL root, ProgressMonitor mon ) → org.das2.util.filesystem.FileSystem
create( java.net.URI root ) → org.das2.util.filesystem.FileSystem
create( java.net.URI root, ProgressMonitor mon ) → org.das2.util.filesystem.FileSystem
createFileSystem
createFileSystem( String directory ) → org.das2.util.filesystem.FileSystem
create a new filesystem that is a part of this filesystem, rooted at
directory.
Parameters
directory - subdirectory within the filesystem.
Returns:
the new FileSystem
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getExceptionHandler
getExceptionHandler( ) → org.das2.util.ExceptionHandler
return the exception handler.
Returns:
the exception handler.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getFileObject
getFileObject( String filename ) → org.das2.util.filesystem.FileObject
return the FileObject that corresponds to the name.
Parameters
filename - the file name within the filesystem
Returns:
the FileObject
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getListing
getListing( org.das2.util.filesystem.FileSystem.DirectoryEntry[] des ) → String[]
part of the refactoring to cache time stamps as well, this convenience method returns the old string.
This returns des.name, plus '/' if it's a directory.
Parameters
des - array of directory entries.
Returns:
des.name, and
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getListing( java.util.Map des ) → String[]
getLocalRoot
getLocalRoot( ) → java.io.File
return the folder that is a local copy of the filesystem.
For LocalFilesystem, this is the same as the filesystem. For remote
filesystems, this is a folder within their home directory.
Note File.getAbsolutePath() returns the string representation of this root.
Returns:
the folder that is a local copy of the filesystem.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getProperty
getProperty( String name ) → Object
return a filesystem property, such as PROP_CASE_INSENSITIVE.
Parameters
name - property name, e.g. PROP_CASE_INSENSITIVE
Returns:
the property value, e.g. Boolean.TRUE
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getRootURI
getRootURI( ) → java.net.URI
return the URI identifying the root of the filesystem.
Returns:
a java.net.URI
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
isDirectory
isDirectory( String filename ) → boolean
return true if the name is a directory.
Parameters
filename - the name
Returns:
true if the name is a directory.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
listDirectory
listDirectory( String directory ) → String[]
returns a list of the names of the files in a directory. Names ending
in "/" are themselves directories, and the "/" is not part of the name.
This is optional, and a directory may or may not be tagged with the trailing
slash.
Parameters
directory - the directory name within the filesystem.
Returns:
list of files and folders within the filesystem.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
listDirectory( String directory, ProgressMonitor monitor ) → String[]
listDirectory( String directory, String regex ) → String[]
listDirectory( String directory, String regex, ProgressMonitor monitor ) → String[]
listDirectoryDeep
listDirectoryDeep( String directory, String regex ) → String[]
do a deep listing of directories, resolving wildcards along the way. Note this
can be quite expensive, so be careful when levels are too deep.
Parameters
directory - location within the filesystem.
regex - regular expression (.*\.dat) (not a glob like *.dat).
Returns:
the entire path of each matching name, including the directory within the filesystem.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
peek
peek( java.net.URI root ) → org.das2.util.filesystem.FileSystem
allow factories to peek, so they can see if there is a parent that is offline.
Parameters
root - the URI
Returns:
null if not existing, or the filesystem for the URI.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
peekInstances
peekInstances( ) → org.das2.util.filesystem.FileSystem[]
return a copy of all cached filesystems
Returns:
an org.das2.util.filesystem.FileSystem[]
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
recreate
recreate( java.net.URI root ) → org.das2.util.filesystem.FileSystem
creates a FileSystem, removing and recreating it if it was in the cache.
Parameters
root - an URI
Returns:
an org.das2.util.filesystem.FileSystem
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
recreate( java.net.URI root, ProgressMonitor mon ) → org.das2.util.filesystem.FileSystem
registerFileSystemFactory
registerFileSystemFactory( String proto, org.das2.util.filesystem.FileSystemFactory factory ) → void
register a code for handling a filesystem type. For example, an
FTP implementation can be registered to handle URIs like "ftp://autoplot.org/"
Parameters
proto - protocol identifier, like "ftp" "http" or "sftp"
factory - the factory which will handle the URI.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
reset
reset( ) → void
remove all the cached FileSystem instances.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
reset( org.das2.util.filesystem.FileSystem fs ) → void
setExceptionHandler
setExceptionHandler( org.das2.util.ExceptionHandler eh ) → void
set the exception handler that is called when exceptions occur.
Parameters
eh - the exception handler.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
settings
settings( ) → org.das2.util.filesystem.FileSystemSettings
access the file system settings.
Returns:
the single settings object.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
splitUrl
splitUrl( String surl ) → String[]
returns a String[5]:
[0] is proto "http://"
[1] will be the host
[2] is proto + path
[3] is proto + path + file
[4] is file ext
[5] is params, not including ?.
The URL must start with one of file:, ftp://, http://, https://, sftp://
and "c:" is interpreted as "file:///c:..."
Parameters
surl - a URL string to parse.
Returns:
the parsed URL.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
toCanonicalFilename
toCanonicalFilename( String filename ) → String
returns the canonical name /a/b/c.dat of a string that
may contain backslashes and might not have the leading /
and trailing slashes. Also, double slashes (//) are
removed. Even for Windows files, forward slashes are used.
Parameters
filename - name
Returns:
name with \ converted to /, etc.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
toCanonicalFolderName
toCanonicalFolderName( String name ) → String
returns the canonical name (/a/b/) of a string that
may contain backslashes and might not have the leading /
and trailing slashes. Also, double slashes (//) are
removed. Note this is the name of the FileObject
within the FileSystem.
Parameters
name - folder name
Returns:
name with \ converted to /, etc.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]