fr.paris5.shaman.util
Class StreamCopier

java.lang.Object
  |
  +--fr.paris5.shaman.util.StreamCopier

public class StreamCopier
extends java.lang.Object

Copies content from one stream to another.

This class can handle streams of different types, deferring stream instantiation to the time of the call of copy() method.

Version:
$Id: StreamCopier.java,v 1.1 2002/07/04 13:36:23 caillette Exp $
Author:
Laurent Caillette

Constructor Summary
StreamCopier(java.io.File sourceFile, java.io.OutputStream destination)
           
StreamCopier(java.io.File sourceFile, java.io.OutputStream destination, int bufferSize)
           
StreamCopier(java.io.InputStream source, java.io.File destination)
           
StreamCopier(java.io.InputStream source, java.io.File destinationFile, int bufferSize)
           
StreamCopier(java.io.InputStream source, java.io.OutputStream destination)
           
StreamCopier(java.io.InputStream source, java.io.OutputStream destination, int bufferSize)
           
 
Method Summary
 void copy()
          Copies source content to destinationFile.
protected  void performCopy(java.io.InputStream source, java.io.OutputStream destination)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamCopier

public StreamCopier(java.io.InputStream source,
                    java.io.File destination)

StreamCopier

public StreamCopier(java.io.InputStream source,
                    java.io.File destinationFile,
                    int bufferSize)

StreamCopier

public StreamCopier(java.io.File sourceFile,
                    java.io.OutputStream destination)

StreamCopier

public StreamCopier(java.io.File sourceFile,
                    java.io.OutputStream destination,
                    int bufferSize)

StreamCopier

public StreamCopier(java.io.InputStream source,
                    java.io.OutputStream destination)

StreamCopier

public StreamCopier(java.io.InputStream source,
                    java.io.OutputStream destination,
                    int bufferSize)
Method Detail

copy

public void copy()
          throws java.io.IOException
Copies source content to destinationFile. destinationFile is created if needed.
Throws:
java.io.IOException - When something got wrong with IOs.
org.apache.avalon.framework.CascadingRuntimeException - When the destination file was not found.

performCopy

protected void performCopy(java.io.InputStream source,
                           java.io.OutputStream destination)
                    throws java.io.IOException


Copyright © 2002 Laurent Caillette and l'Université René Descartes, Paris 5. All rights reserved.