org.progeeks.util
Class FileUtils

java.lang.Object
  extended by org.progeeks.util.FileUtils

public class FileUtils
extends java.lang.Object

Utility methods for dumping streams to disk and copying files, etc..

Version:
$Revision: 1.3 $
Author:
Paul Speed

Constructor Summary
FileUtils()
           
 
Method Summary
static long copyFile(java.io.File source, java.io.File destination)
          Copies the specified file to the specified location.
static long copyFile(java.io.File source, java.io.File destination, ProgressReporter pr)
          Copies the specified file to the specified location.
static long getCrc(java.io.File f)
          Returns the CRC of the specified file.
static long getCrc(java.io.InputStream in)
          Returns the CRC of the specified InputStream.
static long saveStream(java.io.File f, java.io.InputStream in)
          Saves the specified stream to a file and returns the number of bytes written.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

copyFile

public static long copyFile(java.io.File source,
                            java.io.File destination)
                     throws java.io.IOException
Copies the specified file to the specified location. Returns the number of bytes copied.

Throws:
java.io.IOException

copyFile

public static long copyFile(java.io.File source,
                            java.io.File destination,
                            ProgressReporter pr)
                     throws java.io.IOException
Copies the specified file to the specified location. Returns the number of bytes copied and reports its status to the specified progress reporter.

Throws:
java.io.IOException

saveStream

public static long saveStream(java.io.File f,
                              java.io.InputStream in)
                       throws java.io.IOException
Saves the specified stream to a file and returns the number of bytes written.

Throws:
java.io.IOException

getCrc

public static long getCrc(java.io.InputStream in)
                   throws java.io.IOException
Returns the CRC of the specified InputStream. The supplied stream must be closed by the caller.

Throws:
java.io.IOException

getCrc

public static long getCrc(java.io.File f)
                   throws java.io.IOException
Returns the CRC of the specified file.

Throws:
java.io.IOException


Copyright © 2002-2003 Paul Speed. All Rights Reserved.