org.apache.felix.ipojo.manipulator.util
Class Streams

java.lang.Object
  extended by org.apache.felix.ipojo.manipulator.util.Streams

public class Streams
extends java.lang.Object

Streams is a utility class that helps to manipulate streams.

Author:
Felix Project Team

Method Summary
static void close(java.io.Closeable... streams)
          Close all the streams
static byte[] readBytes(java.io.InputStream is)
          Read the content of the given InputStream as a byte array.
static void transfer(java.io.InputStream is, java.io.OutputStream os)
          Transfer the given InputStream content in the given OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public static void close(java.io.Closeable... streams)
Close all the streams

Parameters:
streams - Streams to be closed

transfer

public static void transfer(java.io.InputStream is,
                            java.io.OutputStream os)
                     throws java.io.IOException
Transfer the given InputStream content in the given OutputStream.

Parameters:
is - input
os - output
Throws:
java.io.IOException - if there is a transfer error.

readBytes

public static byte[] readBytes(java.io.InputStream is)
                        throws java.io.IOException
Read the content of the given InputStream as a byte array. Notice that this method automatically closes the InputStream

Parameters:
is - source
Returns:
the content of the InputStream
Throws:
java.io.IOException - if stream's content cannot be read/written


Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved.