de.janrufmonitor.util.io
Class Stream

java.lang.Object
  extended by de.janrufmonitor.util.io.Stream

public class Stream
extends Object

This class provides support for stream copy capabilities

Author:
Thilo Brandt

Constructor Summary
Stream()
           
 
Method Summary
static void copy(InputStream in, OutputStream out)
          Copy an inputstream into an outputstream without closing the streams and with the default buffer size of Short.MAX_VALUE (32767 bytes)
static void copy(InputStream in, OutputStream out, boolean finalize)
          Copy an inputstream into an outputstream with the default buffer size of Short.MAX_VALUE (32767 bytes).
static void copy(InputStream in, OutputStream out, boolean finalize, int bufSize)
          Copy an inputstream into an outputstream with the specified buffer size.
static void copy(InputStream in, OutputStream out, int bufSize)
          Copy an inputstream into an outputstream without closing the streams and with the specified buffer size.
static void first(InputStream in, OutputStream out, int n)
          Read the first n bytes from the InputStream to the OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stream

public Stream()
Method Detail

copy

public static void copy(InputStream in,
                        OutputStream out,
                        boolean finalize,
                        int bufSize)
                 throws IOException
Copy an inputstream into an outputstream with the specified buffer size. Both streams are finalized (closed) if the finalize flag is set to true.

Parameters:
in - InputStream object (could also be buffered)
out - OutputStream object
finalize - true if both streams should be closed after the copy
bufSize - size of the copy buffer
Throws:
IOException

first

public static void first(InputStream in,
                         OutputStream out,
                         int n)
                  throws IOException
Read the first n bytes from the InputStream to the OutputStream.

Parameters:
in - InputStream object (could also be buffered)
out - OutputStream object
n - number of bytes to read (max. length: Short.MAX_VALUE)
Throws:
IOException

copy

public static void copy(InputStream in,
                        OutputStream out)
                 throws IOException
Copy an inputstream into an outputstream without closing the streams and with the default buffer size of Short.MAX_VALUE (32767 bytes)

Parameters:
in -
out -
Throws:
IOException

copy

public static void copy(InputStream in,
                        OutputStream out,
                        boolean finalize)
                 throws IOException
Copy an inputstream into an outputstream with the default buffer size of Short.MAX_VALUE (32767 bytes). Both streams are finalized (closed) if the finalize flag is set to true.

Parameters:
in -
out -
Throws:
IOException

copy

public static void copy(InputStream in,
                        OutputStream out,
                        int bufSize)
                 throws IOException
Copy an inputstream into an outputstream without closing the streams and with the specified buffer size.

Parameters:
in -
out -
Throws:
IOException


Copyright © 2010 by Thilo Brandt. All Rights Reserved.