com.ebmwebsourcing.easycommons.stream
Class StreamHelper

java.lang.Object
  extended by com.ebmwebsourcing.easycommons.stream.StreamHelper

public class StreamHelper
extends java.lang.Object

Author:
ofabre

Field Summary
static int DEFAULT_BUFFER_SIZE
          Default value is 2048.
 
Constructor Summary
StreamHelper()
           
 
Method Summary
static void copy(java.io.InputStream fromStream, java.io.OutputStream toStream)
          Copies information from the input stream to the output stream using a default buffer size of 2048 bytes.
static void copy(java.io.InputStream fromStream, java.io.OutputStream toStream, int bufferSize)
          Copies information from the input stream to the output stream using the specified buffer size
static byte[] getBytes(java.io.InputStream input)
           
static java.lang.String getString(java.io.InputStream is)
          Return the String representation of an InputStream
 
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

StreamHelper

public StreamHelper()
Method Detail

copy

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

Parameters:
fromStream - the InputStream to read
toStream - the OutputStream to write

copy

public static void copy(java.io.InputStream fromStream,
                        java.io.OutputStream toStream,
                        int bufferSize)
Copies information from the input stream to the output stream using the specified buffer size

Parameters:
fromStream - the InputStream to read
toStream - the OutputStream to write
bufferSize - size of read blocks

getBytes

public static byte[] getBytes(java.io.InputStream input)

getString

public static java.lang.String getString(java.io.InputStream is)
                                  throws java.io.IOException
Return the String representation of an InputStream

NOTE:
At the end, the InputStream is closed.

Parameters:
is -
Returns:
Return the String representation of an InputStream
Throws:
java.io.IOException


Copyright © 2011 Petals Link. All Rights Reserved.