| java.lang.Object com.mockrunner.util.common.StreamUtil
StreamUtil | public class StreamUtil (Code) | | Simple util class for manipulating streams
|
compareReaders | public static boolean compareReaders(Reader sourceReader, Reader targetReader)(Code) | | Compares the content of the readers. If the readers support
marking, they will be reset after the comparison.
Parameters: sourceReader - the source stream Parameters: targetReader - the target stream true , if the streams are identical, false otherwise |
compareStreams | public static boolean compareStreams(InputStream sourceStream, InputStream targetStream)(Code) | | Compares the content of the streams. If the streams support
marking, they will be reset after the comparison.
Parameters: sourceStream - the source stream Parameters: targetStream - the target stream true , if the streams are identical, false otherwise |
copyReader | public static Reader copyReader(Reader sourceReader)(Code) | | Returns a copy of the specified reader. If the specified reader supports
marking, it will be reset after the copy.
Parameters: sourceReader - the stream to reader a copy of the reader |
copyStream | public static InputStream copyStream(InputStream sourceStream)(Code) | | Returns a copy of the specified stream. If the specified stream supports
marking, it will be reset after the copy.
Parameters: sourceStream - the stream to copy a copy of the stream |
getLinesFromReader | public static List getLinesFromReader(Reader reader)(Code) | | Reads the lines from the specified reader and adds them to a List .
Parameters: reader - the reader the List with the lines |
getReaderAsString | public static String getReaderAsString(Reader reader)(Code) | | Returns the contents of the reader as a string.
Parameters: reader - the Reader the reader content as String |
getReaderAsString | public static String getReaderAsString(Reader reader, int length)(Code) | | Returns the contents of the reader as a string.
Parameters: reader - the Reader Parameters: length - the number of chars to copy, if length < 0,the number is unlimited the reader content as String |
getStreamAsByteArray | public static byte[] getStreamAsByteArray(InputStream stream)(Code) | | Returns the contents of the input stream as byte array.
Parameters: stream - the InputStream the stream content as byte array |
getStreamAsByteArray | public static byte[] getStreamAsByteArray(InputStream stream, int length)(Code) | | Returns the contents of the input stream as byte array.
Parameters: stream - the InputStream Parameters: length - the number of bytes to copy, if length < 0,the number is unlimited the stream content as byte array |
|
|