TrueZIP File* 7.0-rc1

de.schlichtherle.truezip.file
Class TIO

java.lang.Object
  extended by de.schlichtherle.truezip.file.TIO

@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
@Immutable
final class TIO
extends Object

Provides fast bulk I/O operations for 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.

Author:
Christian Schlichtherle

Field Summary
(package private) static FsManager MANAGER
          The file system manager to use within this package.
 
Constructor Summary
private TIO()
          You cannot instantiate this class.
 
Method Summary
static boolean contains(File a, File b)
          Returns true 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 a parent of the other path.
static void copy(boolean preserve, File src, File dst)
          Copies a single source file to a destination file.
private static void copy0(boolean preserve, File src, File dst)
          Unchecked parameters version.
static void copyAll(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 copyAll0(boolean preserve, File src, File dst, TArchiveDetector srcDetector, TArchiveDetector dstDetector)
          Unchecked parameters version.
static void deleteAll(File node)
          Recursively deletes the given directory tree or file.
(package private) static InputSocket<?> getInputSocket(File src, BitField<FsInputOption> options)
           
(package private) static OutputSocket<?> getOutputSocket(File dst, BitField<FsOutputOption> options, Entry template)
           
static void moveAll(File src, File dst, TArchiveDetector detector)
          Moves the source directory tree or file to the destination directory tree or file by recursively applying copy-then-delete.
private static void moveAll0(File src, File dst, TArchiveDetector detector)
          Unchecked parameters version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANAGER

static final FsManager MANAGER
The file system manager to use within this package.

Constructor Detail

TIO

private TIO()
You cannot instantiate this class.

Method Detail

moveAll

public static void moveAll(File src,
                           File dst,
                           TArchiveDetector detector)
                    throws IOException
Moves the source directory tree or file to the destination directory tree or file by recursively applying copy-then-delete. Hence, this file system operation works even with archive files or entries within archive files, but is not atomic.

Parameters:
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.
Throws:
IOException - if the source path contains the destination path or an elementary operation fails for any reason.

moveAll0

private static void moveAll0(File src,
                             File dst,
                             TArchiveDetector detector)
                      throws IOException
Unchecked parameters version.

Throws:
IOException

copyAll

public static void copyAll(boolean preserve,
                           File src,
                           File dst,
                           TArchiveDetector srcDetector,
                           TArchiveDetector dstDetector)
                    throws IOException
Recursively copies the source directory tree or file to the destination directory tree or file.

Parameters:
preserve - if an elementary copy operation shall copy 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.
Throws:
IOException - if the source path contains the destination path or an elementary operation fails for any reason.

copyAll0

private static void copyAll0(boolean preserve,
                             File src,
                             File dst,
                             TArchiveDetector srcDetector,
                             TArchiveDetector dstDetector)
                      throws IOException
Unchecked parameters version.

Throws:
IOException

copy

public static void copy(boolean preserve,
                        File src,
                        File dst)
                 throws IOException
Copies a single source file to a destination file. The name of this method is inspired by the Unix command line utility copy.

Parameters:
preserve - if an elementary copy operation shall copy 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.
Throws:
IOException - if the source path contains the destination path or an elementary operation fails for any reason.

copy0

private static void copy0(boolean preserve,
                          File src,
                          File dst)
                   throws IOException
Unchecked parameters version.

Throws:
IOException

getInputSocket

static InputSocket<?> getInputSocket(File src,
                                     BitField<FsInputOption> options)

getOutputSocket

static OutputSocket<?> getOutputSocket(File dst,
                                       BitField<FsOutputOption> options,
                                       @CheckForNull
                                       Entry template)

deleteAll

public static void deleteAll(File node)
                      throws IOException
Recursively deletes the given directory tree or file.

Parameters:
node - the directory tree or file to delete recursively.
Throws:
IOException - if an elementary operation fails for any reason.

contains

public static boolean contains(File a,
                               File b)
Returns true 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 a parent of the other path.

Note that this method uses the absolute path of both files as if by calling File.getAbsolutePath().

Parameters:
a - a file.
b - another file.

TrueZIP File* 7.0-rc1

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.