org.apache.droids.helper
Class Streams

Package class diagram package Streams
java.lang.Object
  extended by org.apache.droids.helper.Streams

public class Streams
extends Object

Helper class for the low level treatment of bytes and streams. Principal usage is to receive a copy of an input stream.


Method Summary
static byte[] streamCopy(InputStream in)
          Reads all bytes from the given input stream and returns the result in an array.
static byte[] streamCopy(InputStream in, int size)
          Reads the specified number of bytes from the given input stream and returns the result in an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

streamCopy

public static byte[] streamCopy(InputStream in)
                         throws IOException
Reads all bytes from the given input stream and returns the result in an array.

Parameters:
in - the input stream to read the bytes from
Returns:
the byte content of the input stream
Throws:
IOException - in case of errors in the underlying java.io methods used

streamCopy

public static byte[] streamCopy(InputStream in,
                                int size)
                         throws IOException
Reads the specified number of bytes from the given input stream and returns the result in an array.

Parameters:
in - the input stream to read the bytes from
size - the number of bytes to read
Returns:
the byte content read from the input stream
Throws:
IOException - in case of errors in the underlying java.io methods used


Copyright © 2008 The Apache Software Foundation