CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.util
Class Files

java.lang.Object
  extended by ch.randelshofer.util.Files

public class Files
extends java.lang.Object

Files.

Version:
1.1 2007-09-13 Added method stream.
1.0 13. Januar 2004 Created.
Author:
Werner Randelshofer

Method Summary
static void copyDirectoryTree(java.io.File srcdir, java.io.File tgtdir)
          Recursively copies all files from the specified source directory to the target directory.
static void copyDirectoryTree(java.io.File srcdir, java.io.File tgtdir, java.io.FileFilter filter)
          Recursively copies all files from the specified source directory to the target directory.
static void copyFile(java.io.File source, java.io.File target)
          Copies to contents of the source file to the target file.
static void copyStream(java.io.InputStream in, java.io.OutputStream out)
          Copies to contents of the input stream to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyDirectoryTree

public static void copyDirectoryTree(java.io.File srcdir,
                                     java.io.File tgtdir)
                              throws java.io.IOException
Recursively copies all files from the specified source directory to the target directory.

Parameters:
srcdir - The source directory.
tgtdir - The target directory.
Throws:
java.io.IOException - when an I/O error occurs.

copyDirectoryTree

public static void copyDirectoryTree(java.io.File srcdir,
                                     java.io.File tgtdir,
                                     java.io.FileFilter filter)
                              throws java.io.IOException
Recursively copies all files from the specified source directory to the target directory.

Parameters:
srcdir - The source directory.
tgtdir - The target directory.
filter - A filter which is used on the files of the srcdir to decide whether it should be copied or not.
Throws:
java.io.IOException - when an I/O error occurs.

copyFile

public static void copyFile(java.io.File source,
                            java.io.File target)
                     throws java.io.IOException
Copies to contents of the source file to the target file. This method does not honor file attributes.

Throws:
java.io.IOException

copyStream

public static void copyStream(java.io.InputStream in,
                              java.io.OutputStream out)
                       throws java.io.IOException
Copies to contents of the input stream to the output stream.

Throws:
java.io.IOException

(c) Werner Randelshofer.
All rights reserved.