Package org.smooks.support
Class StreamUtils
- java.lang.Object
-
- org.smooks.support.StreamUtils
-
public final class StreamUtils extends Object
Stream Utilities.- Author:
- tfennelly
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
readStream(InputStream stream)
Read the supplied InputStream and return as a byte array.static String
readStream(Reader stream)
static String
readStreamAsString(InputStream stream, String encoding)
Read the supplied InputStream and return as a byte array.
-
-
-
Method Detail
-
readStream
public static byte[] readStream(InputStream stream) throws IOException
Read the supplied InputStream and return as a byte array.- Parameters:
stream
- The stream to read.- Returns:
- byte array containing the Stream data.
- Throws:
IOException
- Exception reading from the stream.
-
readStreamAsString
public static String readStreamAsString(InputStream stream, String encoding) throws IOException
Read the supplied InputStream and return as a byte array.- Parameters:
stream
- The stream to read.encoding
- The encoding to use.- Returns:
- A String containing the Stream data.
- Throws:
IOException
- Exception reading from the stream.
-
readStream
public static String readStream(Reader stream) throws IOException
- Throws:
IOException
-
-