org.apache.log4j.lf5.util
Class StreamUtils

java.lang.Object
  extended by org.apache.log4j.lf5.util.StreamUtils

public abstract class StreamUtils
extends Object

Provides utility methods for input and output streams.

Author:
Richard Wan

Field Summary
static int DEFAULT_BUFFER_SIZE
          Default value is 2048.
 
Constructor Summary
StreamUtils()
           
 
Method Summary
static void copy(InputStream input, OutputStream output)
          Copies information from the input stream to the output stream using a default buffer size of 2048 bytes.
static void copy(InputStream input, OutputStream output, int bufferSize)
          Copies information from the input stream to the output stream using the specified buffer size
static void copyThenClose(InputStream input, OutputStream output)
          Copies information between specified streams and then closes both of the streams.
static byte[] getBytes(InputStream input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
Default value is 2048.

See Also:
Constant Field Values
Constructor Detail

StreamUtils

public StreamUtils()
Method Detail

copy

public static void copy(InputStream input,
                        OutputStream output)
                 throws IOException
Copies information from the input stream to the output stream using a default buffer size of 2048 bytes.

Throws:
IOException

copy

public static void copy(InputStream input,
                        OutputStream output,
                        int bufferSize)
                 throws IOException
Copies information from the input stream to the output stream using the specified buffer size

Throws:
IOException

copyThenClose

public static void copyThenClose(InputStream input,
                                 OutputStream output)
                          throws IOException
Copies information between specified streams and then closes both of the streams.

Throws:
IOException

getBytes

public static byte[] getBytes(InputStream input)
                       throws IOException
Returns:
a byte[] containing the information contained in the specified InputStream.
Throws:
IOException


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.