Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.io
Class CopyingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by ch.randelshofer.io.CopyingInputStream
All Implemented Interfaces:
java.io.Closeable

public class CopyingInputStream
extends java.io.FilterInputStream

Copies all data that has been read through this input stream into an OutputStream.

Version:
1.0.1 2008-08-18 Skip method did not return negative number in case of EOF.
1.0 December 28, 2006 Created.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CopyingInputStream(java.io.InputStream in, java.io.OutputStream out)
          Creates a new instance.
 
Method Summary
 java.io.OutputStream getCopyStream()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void setCopyStream(java.io.OutputStream out)
           
 long skip(long n)
           
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyingInputStream

public CopyingInputStream(java.io.InputStream in,
                          java.io.OutputStream out)
Creates a new instance.

Method Detail

getCopyStream

public java.io.OutputStream getCopyStream()

setCopyStream

public void setCopyStream(java.io.OutputStream out)

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException

Copyright 2012-02-25 Werner Randelshofer