java.lang.Object java.io.File cz.dhl.io.LocalFile
Allows uniform manipulation with local files. Equivalent for File object.
Only absolute pathnames are supported!
CoFile
,
File
,
Serialized FormField Summary |
Fields inherited from class java.io.File |
pathSeparator, pathSeparatorChar, separator, separatorChar |
Constructor Summary | |
LocalFile(LocalFile dir,
java.lang.String name)
Creates a new LocalFile instance from a parent abstract pathname and a child pathname string. |
|
LocalFile(java.lang.String path)
Creates a new LocalFile instance by converting the given pathname string into an abstract pathname. |
|
LocalFile(java.lang.String path,
java.lang.String name)
Creates a new LocalFile instance from a parent pathname string and a child pathname string. |
Method Summary | |
boolean |
canRead()
Tests whether the application can read the file denoted by this abstract pathname. |
boolean |
canWrite()
Tests whether the application can modify to the file denoted by this abstract pathname. |
int |
compareExtToIgnoreCase(CoOrder file)
Compares two abstract pathnames lexicographically by extension. |
int |
compareNameToIgnoreCase(CoOrder file)
Compares two abstract pathnames lexicographically by name. |
int |
compareTo(java.lang.Object o)
Compares two abstract pathnames lexicographically (by pathname). |
boolean |
delete()
Deletes the file or directory denoted by this abstract pathname. |
boolean |
equals(java.lang.Object o)
|
boolean |
equalsExtTo(java.lang.String filter)
Tests this abstract pathname for equality with the given extension. |
boolean |
equalsExtTo(java.lang.String[] filter)
Tests this abstract pathname for equality with one of the given extensions. |
boolean |
exists()
Tests whether the file denoted by this abstract pathname exists. |
java.lang.String |
getAccess()
Returns access string. |
CoConsole |
getConsole()
Gets console if implemented or null. |
char |
getDataType()
Get type of data transfer. |
java.lang.String |
getHost()
Returns the host name. |
java.io.InputStream |
getInputStream()
Returns an input stream for this file. |
java.lang.String |
getName()
Returns the name of the file represented by this object. |
java.io.OutputStream |
getOutputStream()
Returns an output stream for this file. |
java.io.OutputStream |
getOutputStream(boolean append)
Returns an output stream for this file. |
java.lang.String |
getParent()
Returns the parent part of the pathname of this File object, or null if the name has no parent part. |
java.lang.String[] |
getPathArray()
Tokens the pathname by separator. |
int |
getPathDepth()
Returns depth (number of levels) of this abstract pathname. |
CoFile |
getPathFragment(int depth)
Returns abstract pathname containing first depth levels of this pathname of the file represented by this object. |
boolean |
isAbsolute()
Tests if the file represented by this File object is an absolute pathname. |
boolean |
isConnected()
Tests if corresponding connection to remote host is active. |
boolean |
isDirectory()
Tests if the file represented by this File object is a directory. |
boolean |
isFile()
Tests if the file represented by this File object is a "normal" file. |
boolean |
isHidden()
Tests whether the file named by this abstract pathname is a hidden file. |
boolean |
isLink()
Tests whether the file named by this abstract pathname is a link. |
boolean |
isSpecial()
Tests whether the file named by this abstract pathname is a special file. |
long |
lastModified()
Returns the time that the file represented by this File object was last modified. |
java.lang.String |
lastModifiedString()
Returns the time string that the file represented by this CoFile object was last modified in short mode. |
long |
length()
Returns the length of the file represented by this File object. |
CoFile[] |
listCoFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname. |
CoFile[] |
listCoFiles(CoFilenameFilter filter)
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. |
CoFile[] |
listCoRoots()
List the available filesystem roots. |
boolean |
mkdir()
Creates the directory named by this abstract pathname. |
boolean |
mkdirs()
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. |
CoFile |
newFileChild(java.lang.String child)
Creates a new file instance from this abstract pathname and a child string. |
CoFile |
newFileRename(java.lang.String name)
Creates a new file instance from a parent of this abstract pathname and a name string. |
java.lang.String |
propertyString()
Returns a property string. |
boolean |
renameTo(CoFile dest)
Renames the file denoted by this abstract pathname. |
boolean |
startsWithIgnoreCase(char ch)
Tests this abstract pathname whether name starts with the given character. |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.io.File |
compareTo, createNewFile, createTempFile, createTempFile, deleteOnExit, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getParentFile, getPath, hashCode, list, list, listFiles, listFiles, listFiles, listRoots, renameTo, setLastModified, setReadOnly, toURI, toURL |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface cz.dhl.io.CoFile |
getAbsolutePath |
Constructor Detail |
public LocalFile(LocalFile dir, java.lang.String name)
public LocalFile(java.lang.String path)
public LocalFile(java.lang.String path, java.lang.String name)
Method Detail |
public boolean canRead()
CoFile
canRead
in interface CoFile
public boolean canWrite()
CoFile
canWrite
in interface CoFile
public int compareExtToIgnoreCase(CoOrder file)
CoOrder
compareExtToIgnoreCase
in interface CoOrder
public int compareNameToIgnoreCase(CoOrder file)
CoOrder
compareNameToIgnoreCase
in interface CoOrder
public int compareTo(java.lang.Object o)
CoOrder
compareTo
in interface CoOrder
public boolean delete() throws java.lang.SecurityException
CoFile
delete
in interface CoFile
java.lang.SecurityException
public boolean equals(java.lang.Object o)
public boolean equalsExtTo(java.lang.String filter)
CoOrder
equalsExtTo
in interface CoOrder
filter
- must be uppercase string with a leading '.' sign;
example: ".TXT" or ".HTM" or ".HTML" etc ...public boolean equalsExtTo(java.lang.String[] filter)
CoOrder
equalsExtTo
in interface CoOrder
filter
- must be array of uppercase strings with a leading '.' sign;
example: { ".TXT", ".HTM", ".HTML", etc ... }public boolean exists()
CoFile
exists
in interface CoFile
public java.lang.String getAccess()
CoFile
getAccess
in interface CoFile
public CoConsole getConsole()
CoOpen
getConsole
in interface CoOpen
public char getDataType()
CoOpen
getDataType
in interface CoOpen
public java.lang.String getHost()
CoFile
getHost
in interface CoFile
public java.io.InputStream getInputStream() throws java.io.IOException
CoOpen
getInputStream
in interface CoOpen
java.io.IOException
public java.lang.String getName()
CoFile
getName
in interface CoFile
public java.io.OutputStream getOutputStream() throws java.io.IOException
CoOpen
getOutputStream
in interface CoOpen
java.io.IOException
public java.io.OutputStream getOutputStream(boolean append) throws java.io.IOException
CoOpen
getOutputStream
in interface CoOpen
java.io.IOException
public java.lang.String getParent()
CoFile
getParent
in interface CoFile
public java.lang.String[] getPathArray()
CoFile
getPathArray
in interface CoFile
[Server-name]/[Disk-root]
[1st-level-parent-dir-name]
[2nd-level-parent-dir-name]
...
[Top-level-parent-dir-name]
public int getPathDepth()
CoFile
getPathDepth
in interface CoFile
public CoFile getPathFragment(int depth)
CoFile
getPathFragment
in interface CoFile
public boolean isAbsolute()
CoFile
isAbsolute
in interface CoFile
public boolean isConnected()
CoOrder
isConnected
in interface CoOrder
public boolean isDirectory()
CoFile
isDirectory
in interface CoFile
public boolean isFile()
CoFile
isFile
in interface CoFile
public boolean isHidden()
CoFile
isHidden
in interface CoFile
public boolean isLink()
CoFile
isLink
in interface CoFile
public boolean isSpecial()
CoFile
isSpecial
in interface CoFile
public long lastModified()
CoFile
lastModified
in interface CoFile
public java.lang.String lastModifiedString()
CoFile
lastModifiedString
in interface CoFile
public long length()
CoFile
length
in interface CoFile
public CoFile[] listCoFiles() throws java.lang.SecurityException
CoFile
listCoFiles
in interface CoFile
java.lang.SecurityException
public CoFile[] listCoFiles(CoFilenameFilter filter) throws java.lang.SecurityException
CoFile
CoFile.listCoFiles()
} method, except that the strings
in the returned array must satisfy the filter. If the given filter
is null then all names are accepted.
listCoFiles
in interface CoFile
java.lang.SecurityException
public CoFile[] listCoRoots()
CoFile
listCoRoots
in interface CoFile
public boolean mkdir() throws java.lang.SecurityException
CoFile
mkdir
in interface CoFile
java.lang.SecurityException
public boolean mkdirs() throws java.lang.SecurityException
CoFile
mkdirs
in interface CoFile
java.lang.SecurityException
public CoFile newFileChild(java.lang.String child)
CoOpen
newFileChild
in interface CoOpen
public CoFile newFileRename(java.lang.String name)
CoOpen
newFileRename
in interface CoOpen
public java.lang.String propertyString()
CoFile
propertyString
in interface CoFile
public boolean renameTo(CoFile dest) throws java.lang.SecurityException
CoFile
renameTo
in interface CoFile
java.lang.SecurityException
public boolean startsWithIgnoreCase(char ch)
CoOrder
startsWithIgnoreCase
in interface CoOrder
public java.lang.String toString()
CoFile
toString
in interface CoFile