org.apache.fulcrum.jce.crypto
Class StreamUtil

java.lang.Object
  extended by org.apache.fulcrum.jce.crypto.StreamUtil

public final class StreamUtil
extends Object

Helper class to provde generic stream functions.

Author:
Siegfried Goeschl

Constructor Summary
StreamUtil()
           
 
Method Summary
static long copy(InputStream is, OutputStream os)
          Pumps the input stream to the output stream.
static InputStream createInputStream(Object source)
          Create an input stream supporting the following types String (using the UTF-8 encoded content) File byte[] char[] ByteArrayOutputStream InputStream
static OutputStream createOutputStream(Object target)
          Create an output stream supporting the following types File String OutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamUtil

public StreamUtil()
Method Detail

createInputStream

public static InputStream createInputStream(Object source)
                                     throws IOException
Create an input stream supporting the following types

Parameters:
source - the source object
Returns:
the created input stream
Throws:
IOException - creating the input stream failed

createOutputStream

public static OutputStream createOutputStream(Object target)
                                       throws IOException
Create an output stream supporting the following types

Parameters:
target - the target object
Returns:
the output stream
Throws:
IOException - creating the output stream failed

copy

public static long copy(InputStream is,
                        OutputStream os)
                 throws IOException
Pumps the input stream to the output stream.

Parameters:
is - the source input stream
os - the target output stream
Returns:
the number of bytes copied
Throws:
IOException - the copying failed


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.