Package org.apache.fulcrum.jce.crypto
Class StreamUtil
- java.lang.Object
-
- org.apache.fulcrum.jce.crypto.StreamUtil
-
public final class StreamUtil extends Object
Helper class to provde generic stream functions.- Author:
- Siegfried Goeschl
-
-
Constructor Summary
Constructors Constructor Description StreamUtil()
-
Method Summary
Modifier and Type Method Description 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 InputStreamstatic OutputStream
createOutputStream(Object target)
Create an output stream supporting the following types File String OutputStream
-
-
-
Method Detail
-
createInputStream
public static InputStream createInputStream(Object source) throws IOException
Create an input stream supporting the following types- String (using the UTF-8 encoded content)
- File
- byte[]
- char[]
- ByteArrayOutputStream
- InputStream
- 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- File
- String
- OutputStream
- 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 streamos
- the target output stream- Returns:
- the number of bytes copied
- Throws:
IOException
- the copying failed
-
-