org.ibisph.util
Class StreamLib

java.lang.Object
  extended by org.ibisph.util.StreamLib

public abstract class StreamLib
extends java.lang.Object

StreamLib is an abstract library class with odd ball streams methods.

Author:
Garth Braithwaite, STG

Constructor Summary
StreamLib()
           
 
Method Summary
static java.lang.String getContentAndClose(java.io.InputStream inputStream)
          Captures the specified input stream's contents to a string.
static int inputToOutputAndClose(java.io.InputStream inputStream, java.io.OutputStream outputStream)
          Streams input stream's contents to the output stream.
static int writeAndClose(java.io.OutputStream outputStream, byte[] content)
          Writes the bytes to the output stream and closes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamLib

public StreamLib()
Method Detail

getContentAndClose

public static java.lang.String getContentAndClose(java.io.InputStream inputStream)
                                           throws java.io.IOException
Captures the specified input stream's contents to a string.

Parameters:
inputStream - Stream to capture.
Returns:
Contents of the stream as a String.
Throws:
java.io.IOException - Stream related.

inputToOutputAndClose

public static int inputToOutputAndClose(java.io.InputStream inputStream,
                                        java.io.OutputStream outputStream)
                                 throws java.io.IOException
Streams input stream's contents to the output stream.

Parameters:
inputStream - Source input stream.
outputStream - Destination output stream.
Returns:
Number of int values read/written.
Throws:
java.io.IOException - Associated with stream operations.

writeAndClose

public static int writeAndClose(java.io.OutputStream outputStream,
                                byte[] content)
                         throws java.io.IOException
Writes the bytes to the output stream and closes.

Parameters:
content - Bytes to be written to the output stream.
outputStream - Destination output stream.
Returns:
Number of int values read/written.
Throws:
java.io.IOException - Associated with stream operations.