|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.File
de.goerntkai.toolbox.fs.File
Represents a file object in the file system. The base
java.io.File
is extended with copyTo
which copies
the file to the given destination.
File
,
Serialized FormField Summary | |
static java.lang.String |
SUFFIX_SEPERATOR
Seperates the bare name from the suffix. |
Fields inherited from class java.io.File |
pathSeparator, pathSeparatorChar, separator, separatorChar |
Constructor Summary | |
File(java.io.File theFile)
Creates a new File from an object of its superclass. |
|
File(java.io.File theParent,
java.lang.String theChild)
Inherited from java.io.File . |
|
File(java.lang.String thePathname)
Inherited from java.io.File . |
|
File(java.lang.String theParent,
java.lang.String theChild)
Inherited from java.io.File . |
|
File(java.net.URI theURI)
Inherited from java.io.File . |
Method Summary | |
long |
copyTo(File destination)
Copies this file object to the given destination file. |
long |
copyTo(java.lang.String destinationFile)
Copies this file object to the given destination file. |
java.lang.String |
getBareName()
Returns the bare name of the file name. |
java.lang.String |
getSuffix()
Returns the suffix of the file name. |
Methods inherited from class java.io.File |
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String SUFFIX_SEPERATOR
Constructor Detail |
public File(java.io.File theFile)
Creates a new File
from an object of its superclass.
theFile
- to createpublic File(java.io.File theParent, java.lang.String theChild)
Inherited from java.io.File
.
theParent
- to create the child intheChild
- to createFile
public File(java.lang.String thePathname)
Inherited from java.io.File
.
thePathname
- of the fileFile
public File(java.lang.String theParent, java.lang.String theChild)
Inherited from java.io.File
.
theParent
- to create the child intheChild
- to createFile
public File(java.net.URI theURI)
Inherited from java.io.File
.
theURI
- of the fileFile
Method Detail |
public final long copyTo(File destination) throws java.io.IOException
Copies this file object to the given destination file. Copies only
files, no directories. Uses FileInputStream
for the source
and FileOutputStream
for the destination. The copy will
take byte for byte. Returns the number of bytes that were copied.
Returns -1
if the source was no file. Any existing file
will be overwritten.
In case that parent directories of the destination files are missing this method will create them.
destination
- the destination file
java.io.IOException
- on problems with the streamspublic final long copyTo(java.lang.String destinationFile) throws java.io.IOException
Copies this file object to the given destination file. Just calls
copyTo(File)
with the File
created from
destinationFile
.
destinationFile
- where to copy the file to
java.io.IOException
- on problems with the streamscopyTo(File)
public final java.lang.String getBareName()
Returns the bare name of the file name. The last dot is the splitting element. The bare name is the part left to the last dot. For example, the file name is file-0.1.txt the bare name will be file-0.1.
public final java.lang.String getSuffix()
Returns the suffix of the file name. The last dot is the splitting element. The suffix is the part right to the last dot. For example, the file name is file-0.1.txt the suffix will be txt.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |