public class StreamUtil extends Object
| Constructor and Description |
|---|
StreamUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
compareReaders(Reader sourceReader,
Reader targetReader)
Compares the content of the readers.
|
static boolean |
compareStreams(InputStream sourceStream,
InputStream targetStream)
Compares the content of the streams.
|
static Reader |
copyReader(Reader sourceReader)
Returns a copy of the specified reader.
|
static InputStream |
copyStream(InputStream sourceStream)
Returns a copy of the specified stream.
|
static List<String> |
getLinesFromReader(Reader reader)
Reads the lines from the specified reader and adds them to a
List. |
static String |
getReaderAsString(Reader reader)
Returns the contents of the reader as a string.
|
static String |
getReaderAsString(Reader reader,
int length)
Returns the contents of the reader as a string.
|
static byte[] |
getStreamAsByteArray(InputStream stream)
Returns the contents of the input stream as byte array.
|
static byte[] |
getStreamAsByteArray(InputStream stream,
int length)
Returns the contents of the input stream as byte array.
|
public static byte[] getStreamAsByteArray(InputStream stream)
stream - the InputStreampublic static byte[] getStreamAsByteArray(InputStream stream, int length)
stream - the InputStreamlength - the number of bytes to copy, if length is negative,
the number is unlimitedpublic static String getReaderAsString(Reader reader)
reader - the ReaderStringpublic static String getReaderAsString(Reader reader, int length)
reader - the Readerlength - the number of chars to copy, if negative,
the number is unlimitedStringpublic static InputStream copyStream(InputStream sourceStream)
sourceStream - the stream to copypublic static Reader copyReader(Reader sourceReader)
sourceReader - the stream to readerpublic static boolean compareStreams(InputStream sourceStream, InputStream targetStream)
sourceStream - the source streamtargetStream - the target streamtrue, if the streams are identical, false otherwisepublic static boolean compareReaders(Reader sourceReader, Reader targetReader)
sourceReader - the source streamtargetReader - the target streamtrue, if the streams are identical, false otherwiseCopyright © 2003-2015. All Rights Reserved.