edu.sdsc.grid.io.srb
Class SRBContainer

java.lang.Object
  extended by edu.sdsc.grid.io.GeneralFile
      extended by edu.sdsc.grid.io.RemoteFile
          extended by edu.sdsc.grid.io.srb.SRBFile
              extended by edu.sdsc.grid.io.srb.SRBContainer
All Implemented Interfaces:
java.lang.Comparable

public class SRBContainer
extends SRBFile

An abstract representation of a container on the SRB. A container is a way to put together a lot of small files into one larger file to improve performance. This works very well with resources that include tapes (such as HPSS). The whole container is retrieved from tape, cached on SRB disk, and then multiple files can be quickly read and written on the container copy on disk. The SRB handles the book-keeping for the container.

SRBContainer subclasses SRBFile and have certain similarities with SRB directories/collections, the logical groupings of files on the SRB. Containers represent a physical grouping of files on a particular SRB resource. Containers can be placed anywhere on the SRB the user has write privileges.

Since:
JARGON1.0
See Also:
SRBFile

Field Summary
static java.lang.String PRIMARY_SYNC
          Delete the cache copy once the copies have been synchronized.
static java.lang.String PURGE_SYNC
          Delete the cache copy once the copies have been synchronized.
 
Fields inherited from class edu.sdsc.grid.io.srb.SRBFile
completeDirectoryList, FILE_CATALOG, LDAP_CATALOG, MDAS_CATALOG, srbFileSystem
 
Fields inherited from class edu.sdsc.grid.io.GeneralFile
BUFFER_MAX_SIZE, directory, fileName, fileSystem, PATH_SEPARATOR, PATH_SEPARATOR_CHAR, pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
SRBContainer(SRBFile parent, java.lang.String child)
          Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.
SRBContainer(SRBFile parent, java.lang.String child, long containerMaxSize)
          Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.
SRBContainer(SRBFileSystem fileSystem, java.lang.String filePath)
          Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.
SRBContainer(SRBFileSystem fileSystem, java.lang.String filePath, long containerMaxSize)
          Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.
SRBContainer(SRBFileSystem fileSystem, java.lang.String parent, java.lang.String child)
          Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.
SRBContainer(SRBFileSystem fileSystem, java.lang.String parent, java.lang.String child, long containerMaxSize)
          Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.
SRBContainer(java.net.URI uri)
          Creates a new SRBContainer instance by converting the given uri string into an abstract pathname.
 
Method Summary
 void backup(java.lang.String syncType)
          Sync a container.
 boolean canRead()
          Tests whether the application can read from the container denoted by this abstract pathname.
 boolean canWrite()
          Tests whether the application can modify to the container denoted by this abstract pathname.
 int compareTo(GeneralFile pathname)
          Compares two containers lexicographically.
 int compareTo(java.lang.Object o)
          Compares this container to another object.
 void copyFrom(GeneralFile file, boolean forceOverwrite, boolean bulkCopy)
          Copies this file to another file.
 void copyFromLocal(LocalFile localFile)
          Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.
 void copyFromLocal(java.lang.String localFilePath)
          Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.
 void copyTo(GeneralFile file, boolean forceOverwrite, boolean bulkCopy)
          Copies this file to another file.
 void copyToLocal(LocalFile localFile)
          Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.
 void copyToLocal(java.lang.String localFilePath)
          Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.
 void copyToRemote(RemoteFile remoteFile)
          Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.
 boolean createNewFile()
          Atomically creates a new, empty container named by this abstract pathname if and only if a container with this name does not yet exist.
static GeneralFile createTempFile(java.lang.String prefix, java.lang.String suffix)
          Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name.
static GeneralFile createTempFile(java.lang.String prefix, java.lang.String suffix, GeneralFile directory)
           Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name.
 boolean delete()
          Deletes the container denoted by this SRBContainer.
 boolean delete(boolean force)
          Deletes the file or directory denoted by this abstract pathname.
 boolean equals(java.lang.Object obj)
          Tests this abstract pathname for equality with the given object.
 boolean exists()
          Tests whether the container denoted by this abstract pathname exists.
 GeneralFile getAbsoluteFile()
          Returns the absolute form of this abstract pathname.
 GeneralFile getCanonicalFile()
          Returns the canonical form of this abstract pathname.
 long getContainerMaxSize()
           
 java.lang.String getDataType()
           
 GeneralFile getParentFile()
          Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.
 java.lang.String getPermissions()
          Get the permissions of the current user for this SRBContainer: write, read, all, annotate or null.
 MetaDataRecordList[] getPermissions(boolean allUsers)
          Gets all the non null permissions of all SRB users for this SRBContainer: write, read, all, annotate or null.
 java.lang.String getResource()
           
 void include(GeneralFile file)
          Adds the named file to this container.
 boolean isContainer()
          Tests whether the object denoted by this abstract pathname is a container.
 boolean isDirectory()
          Tests whether the file denoted by this abstract pathname is a directory.
 boolean isFile()
          Tests whether the file denoted by this abstract pathname is a normal file.
 boolean isHidden()
          Tests whether the file named by this abstract pathname is a hidden file.
 long lastModified()
          Returns the time that the file denoted by this abstract pathname was last modified.
 long length()
          Returns the length of the container denoted by this abstract pathname.
 java.lang.String[] list()
          Returns an array of strings naming the files and directories in the container denoted by this abstract pathname.
 boolean mkdir()
          Creates the container named by this abstract pathname.
 MetaDataRecordList[] query(MetaDataSelect[] selects)
          Removes the named file to this container
 MetaDataRecordList[] query(MetaDataSelect[] selects, int recordsWanted)
           
 boolean renameTo(GeneralFile dest)
          Renames the container denoted by this abstract pathname.
 void replicate(java.lang.String newResource)
          Replicates this container to a new resource.
 void setContainerMaxSize(long containerMaxSize)
          Sets the container size of this SRBContainer object, in bytes.
 
Methods inherited from class edu.sdsc.grid.io.srb.SRBFile
changePermissions, changePermissions, checksum, checksum, copyFrom, copyTo, deleteOnExit, executeProxyCommand, fileCopyStatus, finalize, getCanonicalPath, getCatalogType, getFileSystem, getName, getPath, getPathSeparator, getPathSeparatorChar, getReplicaNumber, getServerLocalPath, getStat, hashCode, isAbsolute, isDirectory, isFile, link, list, modifyMetaData, query, query, query, query, query, register, setDataType, setDirectory, setFileName, setFileSystem, setLastModified, setReadOnly, setReplicaNumber, setResource, setServerLocalPath, toString, toURI, toURL
 
Methods inherited from class edu.sdsc.grid.io.GeneralFile
copyFrom, copyTo, firstQueryResult, getAbsolutePath, getParent, listFiles, listRoots, listRoots, mkdirs
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PURGE_SYNC

public static final java.lang.String PURGE_SYNC
Delete the cache copy once the copies have been synchronized.

See Also:
Constant Field Values

PRIMARY_SYNC

public static final java.lang.String PRIMARY_SYNC
Delete the cache copy once the copies have been synchronized.

See Also:
Constant Field Values
Constructor Detail

SRBContainer

public SRBContainer(SRBFileSystem fileSystem,
                    java.lang.String filePath)
Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.

Parameters:
fileSystem - The connection to the SRB
filePath - The pathname string

SRBContainer

public SRBContainer(SRBFileSystem fileSystem,
                    java.lang.String filePath,
                    long containerMaxSize)
Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.

Parameters:
fileSystem - The connection to the SRB
filePath - A pathname string
containerMaxSize - The size of the container, in bytes

SRBContainer

public SRBContainer(SRBFile parent,
                    java.lang.String child)
Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.

If parent is null then the new SRBContainer instance is created as if by invoking the single-argument SRBContainer constructor on the given child pathname string.

Otherwise the parent abstract pathname is taken to denote a directory, and the child pathname string is taken to denote the container name. If the child pathname string is absolute then it is converted into a relative pathname in a SRB pathname. If parent is the empty string then the new SRBContainer instance is created by converting child into an abstract pathname and resolving the result against the SRB default container directory. Otherwise each pathname string is converted into an abstract pathname and the child abstract pathname is resolved against the parent.

Parameters:
parent - The parent abstract pathname
child - The child pathname string

SRBContainer

public SRBContainer(SRBFile parent,
                    java.lang.String child,
                    long containerMaxSize)
Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.

If parent is null then the new SRBContainer instance is created as if by invoking the single-argument SRBContainer constructor on the given child pathname string.

Otherwise the parent abstract pathname is taken to denote a directory, and the child pathname string is taken to denote the container name. If the child pathname string is absolute then it is converted into a relative pathname in a SRB pathname. If parent is the empty string then the new SRBContainer instance is created by converting child into an abstract pathname and resolving the result against the SRB default container directory. Otherwise each pathname string is converted into an abstract pathname and the child abstract pathname is resolved against the parent.

Parameters:
parent - The parent abstract pathname
child - The child pathname string
containerMaxSize - The size of the container, in bytes

SRBContainer

public SRBContainer(SRBFileSystem fileSystem,
                    java.lang.String parent,
                    java.lang.String child)
Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.

If parent is null then the new SRBContainer instance is created as if by invoking the single-argument SRBContainer constructor on the given child pathname string.

Otherwise the parent abstract pathname is taken to denote a directory, and the child pathname string is taken to denote the container name. If the child pathname string is absolute then it is converted into a relative pathname in a SRB pathname. If parent is the empty string then the new SRBContainer instance is created by converting child into an abstract pathname and resolving the result against the SRB default container directory. Otherwise each pathname string is converted into an abstract pathname and the child abstract pathname is resolved against the parent.

Parameters:
fileSystem - The connection to the SRB
parent - The parent pathname string
child - The child pathname string

SRBContainer

public SRBContainer(SRBFileSystem fileSystem,
                    java.lang.String parent,
                    java.lang.String child,
                    long containerMaxSize)
Creates a new SRBContainer instance by converting the given pathname string into an abstract pathname.

If parent is null then the new SRBContainer instance is created as if by invoking the single-argument SRBContainer constructor on the given child pathname string.

Otherwise the parent abstract pathname is taken to denote a directory, and the child pathname string is taken to denote the container name. If the child pathname string is absolute then it is converted into a relative pathname in a SRB pathname. If parent is the empty string then the new SRBContainer instance is created by converting child into an abstract pathname and resolving the result against the SRB default container directory. Otherwise each pathname string is converted into an abstract pathname and the child abstract pathname is resolved against the parent.

Parameters:
fileSystem - The connection to the SRB
parent - The parent pathname string
child - The child pathname string
containerMaxSize - The size of the container, in bytes

SRBContainer

public SRBContainer(java.net.URI uri)
             throws java.io.IOException
Creates a new SRBContainer instance by converting the given uri string into an abstract pathname.

Parameters:
fileSystem - The connection to the SRB
uri - The uri pathname string
containerMaxSize - The size of the container, in bytes
Throws:
java.io.IOException - If an IOException occurs.
Method Detail

setContainerMaxSize

public void setContainerMaxSize(long containerMaxSize)
Sets the container size of this SRBContainer object, in bytes. The max size of a container cannot be changed if the container already exists on the SRB.

Currently, containers cannot have a max size over 2GB, though they will accept files larger than 2GB. If the container runs out of space it will be renamed to a new container plus some random digits and a new container will be created.
eg. container foo will be renamed foo.1234 and a new foo container will be created.

Throws:
java.lang.IllegalArgumentException - If the containerMaxSize is less than zero.

getContainerMaxSize

public long getContainerMaxSize()
Returns:
the size of this SRBContainer, in bytes.

getResource

public java.lang.String getResource()
                             throws java.io.IOException
Overrides:
getResource in class SRBFile
Returns:
resource the physical resource where this SRBFile is stored.
Throws:
java.io.IOException - If an IOException occurs.

getDataType

public java.lang.String getDataType()
                             throws java.io.IOException
Overrides:
getDataType in class SRBFile
Returns:
dataType The dataType string of this SRBFile.
Throws:
java.io.IOException - If an IOException occurs.

include

public void include(GeneralFile file)
             throws java.io.IOException
Adds the named file to this container. Note, files already on the SRB cannot be added to a container. One reason being a name conflict will occur.

Throws:
java.io.IOException

query

public MetaDataRecordList[] query(MetaDataSelect[] selects)
                           throws java.io.IOException
Removes the named file to this container

Overrides:
query in class SRBFile
Throws:
java.io.IOException

query

public MetaDataRecordList[] query(MetaDataSelect[] selects,
                                  int recordsWanted)
                           throws java.io.IOException
Overrides:
query in class SRBFile
Throws:
java.io.IOException

copyTo

public void copyTo(GeneralFile file,
                   boolean forceOverwrite,
                   boolean bulkCopy)
            throws java.io.IOException
Description copied from class: SRBFile
Copies this file to another file. This object is the source file. The destination file is given as the argument. If the destination file, does not exist a new one will be created. Otherwise the source file will be appended to the destination file. Directories will be copied recursively.

note: Files will be transferred using the SRB parallel transfer protocol. However, appending a file cannot use the parallel copy method. Also, the parallel method may be blocked by some firewalls, see also SRBFileSystem.setFirewallPorts( int, int )

Overrides:
copyTo in class SRBFile
Parameters:
file - The file to receive the data.
forceOverwrite - If the file exists, force it to be overwritten. If the file cannot be overwritten throw IOException.
bulkCopy - If true, bulk copy: Default option, new ports may be opened. Files copied in parallel or bulk as appropriate.
If false, parallel copy: new ports may be opened, files copied in parallel but not in bulk.
Throws:
java.io.IOException - If an IOException occurs.

copyFrom

public void copyFrom(GeneralFile file,
                     boolean forceOverwrite,
                     boolean bulkCopy)
              throws java.io.IOException
Description copied from class: SRBFile
Copies this file to another file. This object is the source file. The destination file is given as the argument. If the destination file, does not exist a new one will be created. Otherwise the source file will be appended to the destination file. Directories will be copied recursively.

note: Files will be transferred using the SRB parallel transfer protocol. However, appending a file cannot use the parallel copy method. Also, the parallel method may be blocked by some firewalls, see also SRBFileSystem.setFirewallPorts( int, int )

Overrides:
copyFrom in class SRBFile
Parameters:
file - The file to receive the data.
bulkCopy - If true, bulk copy: Default option, new ports may be opened. Files copied in parallel or bulk as appropriate.
If false, parallel copy: new ports may be opened, files copied in parallel but not in bulk.
Throws:
java.io.IOException - If an IOException occurs.

copyFromLocal

public void copyFromLocal(LocalFile localFile)
                   throws java.io.IOException
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.

Throws:
java.io.IOException

copyFromLocal

public void copyFromLocal(java.lang.String localFilePath)
                   throws java.io.IOException
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.

Throws:
java.io.IOException

copyToLocal

public void copyToLocal(LocalFile localFile)
                 throws java.io.IOException
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.

Copies the SRB container to the local file system, as if it were a directory. The local file must be a directory. If the local file does not exist, a new one will be created.

Parameters:
localFile - The file to receive the data
Throws:
java.lang.NullPointerException - If localFile is null.
java.io.IOException

copyToLocal

public void copyToLocal(java.lang.String localFilePath)
                 throws java.io.IOException
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.

Copies the SRB container to the local file system, as if it were a directory. If the local file does not exist, a new one will be created.

Parameters:
localFile - The file to be copied
Throws:
java.lang.NullPointerException - If localFile is null.
java.io.IOException

copyToRemote

public void copyToRemote(RemoteFile remoteFile)
                  throws java.io.IOException,
                         java.lang.ClassCastException
Deprecated. Superseded by copyFrom( GeneralFile ). This single new method replaces all the other older copyFrom...() methods. It functions in the same manner as those old methods, but can except any GeneralFile. It also fixes some bugs in those methods.

Copies this file to a new location on the server. If the remoteFile does not exist, one will be created. Otherwise this SRB file is appended to the end of the remote file.

Copying a container to a new logical space would be an unusual action. Replicate is better.

Parameters:
remoteFile - The local file to receive the data.
Throws:
java.lang.ClassCastException - - if the argument is not a SRBFile object.
java.lang.NullPointerException - If remoteFile is null.
java.io.IOException

getPermissions

public java.lang.String getPermissions()
                                throws java.io.IOException
Get the permissions of the current user for this SRBContainer: write, read, all, annotate or null.

Overrides:
getPermissions in class SRBFile
Throws:
java.io.IOException - If an IOException occurs.

getPermissions

public MetaDataRecordList[] getPermissions(boolean allUsers)
                                    throws java.io.IOException
Gets all the non null permissions of all SRB users for this SRBContainer: write, read, all, annotate or null.

Overrides:
getPermissions in class SRBFile
Throws:
java.io.IOException - If an IOException occurs.

replicate

public void replicate(java.lang.String newResource)
               throws java.io.IOException
Replicates this container to a new resource. Each replicant will increment its replication number by 1 from the last replication.

Overrides:
replicate in class SRBFile
Parameters:
newResource - The storage resource name of the new copy.
Throws:
java.io.IOException - If an IOException occurs.

backup

public void backup(java.lang.String syncType)
            throws java.io.IOException
Sync a container. With backup() you can sync the permanant replica with the temporary replica. The default is to synchronize all archival resources. Syncronization types can also be either PURGE_SYNC or PRIMARY_SYNC

Overrides:
backup in class SRBFile
Parameters:
syncType - synchronization type, see PURGE_SYNC and PRIMARY_SYNC. default value is to synchronize all archival resources.
Throws:
java.io.IOException

canRead

public boolean canRead()
Tests whether the application can read from the container denoted by this abstract pathname.

Overrides:
canRead in class SRBFile
Returns:
true if and only if the container specified by this abstract pathname exists and can be read; otherwise false.

canWrite

public boolean canWrite()
Tests whether the application can modify to the container denoted by this abstract pathname.

Overrides:
canWrite in class SRBFile
Returns:
true if and only if the container system actually contains a file denoted by this abstract pathname and the application is allowed to write to the container; otherwise false.

compareTo

public int compareTo(GeneralFile pathname)
Compares two containers lexicographically.

Overrides:
compareTo in class GeneralFile
Parameters:
pathname - The container to be compared to this abstract pathname
Returns:
Zero if the argument is equal to this container, a value less than zero if this container is lexicographically less than the argument, or a value greater than zero if this container is lexicographically greater than the argument

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this container to another object. If the other object is an container, then this function behaves like compareTo(GeneralFile). Otherwise, it throws a ClassCastException, since containers can only be compared to containers.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class GeneralFile
Parameters:
o - The Object to be compared to this abstract pathname
Returns:
If the argument is an container, returns zero if the argument is equal to this container, a value less than zero if this container is lexicographically less than the argument, or a value greater than zero if this container is lexicographically greater than the argument

Throws:
java.lang.ClassCastException - - if the argument is not an container

createNewFile

public boolean createNewFile()
Atomically creates a new, empty container named by this abstract pathname if and only if a container with this name does not yet exist.

Overrides:
createNewFile in class SRBFile
Returns:
true if the named file does not exist and was successfully created; false if the named file already exists

createTempFile

public static GeneralFile createTempFile(java.lang.String prefix,
                                         java.lang.String suffix)
                                  throws java.io.IOException,
                                         java.lang.IllegalArgumentException
Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. Invoking this method is equivalent to invoking createTempFile(prefix, suffix, null).

Parameters:
prefix - The prefix string to be used in generating the file's name; must be at least three characters long
suffix - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
Returns:
An abstract pathname denoting a newly-created empty file
Throws:
java.lang.IllegalArgumentException - If the prefix argument contains fewer than three characters
java.io.IOException - If a file could not be created

createTempFile

public static GeneralFile createTempFile(java.lang.String prefix,
                                         java.lang.String suffix,
                                         GeneralFile directory)
                                  throws java.io.IOException,
                                         java.lang.IllegalArgumentException

Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. If this method returns successfully then it is guaranteed that:

  1. The file denoted by the returned abstract pathname did not exist before this method was invoked, and
  2. Neither this method nor any of its variants will return the same abstract pathname again in the current invocation of the virtual machine.
This method provides only part of a temporary-file facility. To arrange for a file created by this method to be deleted automatically, use the SRBFile.deleteOnExit method.

The prefix argument must be at least three characters long. It is recommended that the prefix be a short, meaningful string such as "hjb" or "mail". The suffix argument may be null, in which case the suffix ".tmp" will be used.

To create the new file, the prefix and the suffix may first be adjusted to fit the limitations of the underlying platform. If the prefix is too long then it will be truncated, but its first three characters will always be preserved. If the suffix is too long then it too will be truncated, but if it begins with a period character ('.') then the period and the first three characters following it will always be preserved. Once these adjustments have been made the name of the new file will be generated by concatenating the prefix, five or more internally-generated characters, and the suffix.

If the directory argument is null then the SRB default temporary-file directory will be used. The default temporary-file directory is specified by the system property java.io.tmpdir. On UNIX systems the default value of this property is typically "/tmp" or "/var/tmp"; on Microsoft Windows systems it is typically "c:\\temp". A different value may be given to this system property when the Java virtual machine is invoked, but programmatic changes to this property are not guaranteed to have any effect upon the the temporary directory used by this method.

Parameters:
prefix - The prefix string to be used in generating the file's name; must be at least three characters long
suffix - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
directory - The directory in which the file is to be created, or null if the default temporary-file directory is to be used
Returns:
An abstract pathname denoting a newly-created empty file
Throws:
java.lang.IllegalArgumentException - If the prefix argument contains fewer than three characters
java.io.IOException - If a file could not be created

delete

public boolean delete()
Deletes the container denoted by this SRBContainer. The container must be empty in order to be deleted.

Overrides:
delete in class SRBFile
Returns:
true if and only if the file or directory is successfully deleted; false otherwise

delete

public boolean delete(boolean force)
Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted.

Overrides:
delete in class SRBFile
Returns:
true if and only if the file or directory is successfully deleted; false otherwise

equals

public boolean equals(java.lang.Object obj)
Tests this abstract pathname for equality with the given object. Returns true if and only if the argument is not null and is an abstract pathname that denotes the same container as this abstract pathname.

Overrides:
equals in class SRBFile
Parameters:
obj - The object to be compared with this abstract pathname
Returns:
true if and only if the objects are the same; false otherwise

exists

public boolean exists()
Tests whether the container denoted by this abstract pathname exists.

Overrides:
exists in class SRBFile
Returns:
true if and only if the container denoted by this abstract pathname exists; false otherwise

getAbsoluteFile

public GeneralFile getAbsoluteFile()
Returns the absolute form of this abstract pathname. Equivalent to new SRBContainer(this.SRBFile.getFileSystem()(), this.GeneralFile.getAbsolutePath()()).

Overrides:
getAbsoluteFile in class GeneralFile
Returns:
The absolute abstract pathname denoting the same container as this abstract pathname

getCanonicalFile

public GeneralFile getCanonicalFile()
Returns the canonical form of this abstract pathname. Equivalent to new SRBContainer(this.SRBFile.getCanonicalPath()()).

Overrides:
getCanonicalFile in class GeneralFile
Returns:
The canonical pathname string denoting the same container as this abstract pathname
Throws:
java.io.IOException - If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries

getParentFile

public GeneralFile getParentFile()
Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.

The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.

Overrides:
getParentFile in class GeneralFile
Returns:
The abstract pathname of the parent directory named by this abstract pathname, or null if this pathname does not name a parent

isContainer

public boolean isContainer()
Tests whether the object denoted by this abstract pathname is a container.

Overrides:
isContainer in class SRBFile
Returns:
true if and only if the file denoted by this abstract pathname exists and is a container; false otherwise

isDirectory

public boolean isDirectory()
Tests whether the file denoted by this abstract pathname is a directory.

Overrides:
isDirectory in class SRBFile
Returns:
true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise

isFile

public boolean isFile()
Tests whether the file denoted by this abstract pathname is a normal file. A file is normal if it is not a directory or a container. Any non-directory or other subclass of SRBFile, such as a SRBContainer, file created by a Java application is guaranteed to be a normal file.

Overrides:
isFile in class SRBFile
Returns:
true if and only if the file denoted by this abstract pathname exists and is a normal file; false otherwise

isHidden

public boolean isHidden()
Tests whether the file named by this abstract pathname is a hidden file.

Overrides:
isHidden in class SRBFile
Returns:
true if and only if the file denoted by this abstract pathname is hidden.

lastModified

public long lastModified()
Returns the time that the file denoted by this abstract pathname was last modified.

Overrides:
lastModified in class SRBFile
Returns:
A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs

length

public long length()
Returns the length of the container denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory. This is the actual amount of data in the container, use getContainerMaxSize() to get the maximum amount of data the container can hold.

Overrides:
length in class GeneralFile
Returns:
The length, in bytes, of the container denoted by this abstract pathname, or 0L if the container does not exist

list

public java.lang.String[] list()
Returns an array of strings naming the files and directories in the container denoted by this abstract pathname.

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

Overrides:
list in class SRBFile
Returns:
An array of strings naming the files and directories in the container denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.

mkdir

public boolean mkdir()
Creates the container named by this abstract pathname. Same as calling the createNewFile method.

Overrides:
mkdir in class SRBFile

renameTo

public boolean renameTo(GeneralFile dest)
Renames the container denoted by this abstract pathname.

Overrides:
renameTo in class SRBFile
Parameters:
dest - The new abstract pathname for the named container
Throws:
java.lang.IllegalArgumentException - If parameter dest is not a SRBFile.