@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) @Immutable final class TBIO extends Object
Files and TFiles.
Note that in contrast to the TFile class, the methods in this
class accept plain old File objects.
However, full advantage is taken if a parameter is a TFile object.
| Modifier | Constructor and Description |
|---|---|
private |
TBIO()
You cannot instantiate this class.
|
| Modifier and Type | Method and Description |
|---|---|
private static void |
checkContains(File a,
File b)
Throws an
IOException if and only if the path represented by
a contains the path represented by b, where a path is
said to contain another path if and only if it is equal or an ancestor
of the other path. |
static void |
cp_r(boolean preserve,
File src,
File dst,
TArchiveDetector srcDetector,
TArchiveDetector dstDetector)
Recursively copies the source directory tree or file to the destination
directory tree or file.
|
private static void |
cp_r0(boolean preserve,
File src,
File dst,
TArchiveDetector srcDetector,
TArchiveDetector dstDetector)
Unchecked parameters version.
|
static void |
cp(boolean preserve,
File src,
File dst)
Copies a single source file to a destination file.
|
private static void |
cp0(boolean preserve,
File src,
File dst)
Unchecked parameters version.
|
private static TArchiveDetector |
getDetector(File file) |
(package private) static InputSocket<?> |
getInputSocket(File src,
BitField<FsInputOption> options)
Returns an input socket for the given file.
|
(package private) static OutputSocket<?> |
getOutputSocket(File dst,
BitField<FsOutputOption> options,
Entry template)
Returns an output socket for the given file.
|
static void |
mv(File src,
File dst,
TArchiveDetector detector)
Moves the source file or directory tree to the destination file or
directory tree by performing a recursive cp-then-delete operation.
|
private static void |
mv0(File src,
File dst,
TArchiveDetector detector)
Unchecked parameters version.
|
static void |
rm_r(File node,
TArchiveDetector detector)
Recursively deletes the given file or directory tree.
|
private static void checkContains(File a, File b) throws IOException
IOException if and only if the path represented by
a contains the path represented by b, where a path is
said to contain another path if and only if it is equal or an ancestor
of the other path.
Note that this method uses the absolute path of both files as if by
calling File.getAbsolutePath().
a - a file.b - another file.IOExceptionpublic static void cp_r(boolean preserve,
File src,
File dst,
TArchiveDetector srcDetector,
TArchiveDetector dstDetector)
throws IOException
preserve - if an elementary cp operation shall cp as much
properties of the source file to the destination file, too.
Currently, only the last modification time is preserved.
Note that this property set may get extended over time.src - the source directory tree or file.
This file system entity needs to exist.dst - the destination directory tree or file.
This file systeme entity may or may not exist.
If it does, its contents are overwritten.srcDetector - the object used to detect any archive files in the
source path.dstDetector - the object used to detect any archive files in the
destination path.IOException - if the source path contains the destination path
or an elementary operation fails for any reason.private static void cp_r0(boolean preserve,
File src,
File dst,
TArchiveDetector srcDetector,
TArchiveDetector dstDetector)
throws IOException
IOExceptionpublic static void cp(boolean preserve,
File src,
File dst)
throws IOException
cp.preserve - if an elementary cp operation shall cp as much
properties of the source file to the destination file, too.
Currently, only the last modification time is preserved.
Note that this property set may get extended over time.src - the source file.
This file system entity needs to exist.dst - the destination file.
This file systeme entity may or may not exist.
If it does, its contents are overwritten.IOException - if the source path contains the destination path
or an elementary operation fails for any reason.private static void cp0(boolean preserve,
File src,
File dst)
throws IOException
IOExceptionprivate static TArchiveDetector getDetector(File file)
static InputSocket<?> getInputSocket(File src, BitField<FsInputOption> options)
src - the file to read.options - the options for accessing the file.static OutputSocket<?> getOutputSocket(File dst, BitField<FsOutputOption> options, @CheckForNull Entry template)
dst - the file to write.options - the options for accessing the file.template - a nullable template from which file attributes shall
get copied.public static void mv(File src, File dst, TArchiveDetector detector) throws IOException
src - the source directory tree or file.
This file system entity needs to exist.dst - the destination directory tree or file.
This file systeme entity may or may not exist.
If it does, its contents are overwritten.detector - the object used to detect any archive files in the
source and destination paths.IOException - if the source path contains the destination path
or an elementary operation fails for any reason.private static void mv0(File src, File dst, TArchiveDetector detector) throws IOException
IOExceptionpublic static void rm_r(File node, TArchiveDetector detector) throws IOException
node - the file or directory tree to delete recursively.IOException - if an elementary operation fails for any reason.Copyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.