public class Streams
extends java.lang.Object
com.google.common.io.ByteStreams
,
com.google.common.io.CharStreams
Constructor and Description |
---|
Streams() |
Modifier and Type | Method and Description |
---|---|
static java.io.ByteArrayOutputStream |
byteArray(byte[] in) |
static java.io.ByteArrayOutputStream |
byteArrayOfString(java.lang.String in) |
static void |
closeQuietly(java.io.Closeable x)
drop-in non-deprecated replacement for
Closeable 's deprecated closeQuiety;
we may wish to review usages, particularly as we drop support for java 1.6,
but until then use this instead of the deprecated method |
static boolean |
compare(java.io.InputStream s1,
java.io.InputStream s2)
True iff the input streams read to completion give identical contents.
|
static void |
copy(java.io.InputStream input,
java.io.OutputStream output) |
static void |
copy(java.io.Reader input,
java.io.Writer output) |
static void |
copyClose(java.io.InputStream input,
java.io.OutputStream output)
copies and closes both
|
static java.lang.String |
getMd5Checksum(java.io.InputStream in) |
static boolean |
logStreamTail(org.slf4j.Logger log,
java.lang.String message,
java.io.ByteArrayOutputStream stream,
int max) |
static java.io.InputStream |
newInputStreamWithContents(java.lang.String contents) |
static java.io.Reader |
newReaderWithContents(java.lang.String contents) |
static java.io.Reader |
reader(java.io.InputStream stream) |
static java.io.Reader |
reader(java.io.InputStream stream,
java.nio.charset.Charset charset) |
static byte[] |
readFully(java.io.InputStream is)
reads the input stream fully, returning a byte array; throws unchecked exception on failure;
to get a string, use
readFully(reader(is)) or readFullyString(is) ;
consider using instead; |
static int |
readFully(java.io.InputStream s,
byte[] buf)
reads the input stream fully into the given byte buffer or until the supplied buffer is full,
returning the number of bytes read
|
static java.lang.String |
readFully(java.io.Reader is)
Consider using
readFullyAndClose(Reader) instead. |
static byte[] |
readFullyAndClose(java.io.InputStream is) |
static java.lang.String |
readFullyAndClose(java.io.Reader is) |
static java.lang.String |
readFullyString(java.io.InputStream is)
Consider using
readFullyStringAndClose(InputStream) instead. |
static java.lang.String |
readFullyStringAndClose(java.io.InputStream is) |
static <any> |
sizeFunction() |
static <any> |
sizeSupplier(java.io.ByteArrayOutputStream src) |
public static void closeQuietly(java.io.Closeable x)
Closeable
's deprecated closeQuiety;
we may wish to review usages, particularly as we drop support for java 1.6,
but until then use this instead of the deprecated methodpublic static java.io.InputStream newInputStreamWithContents(java.lang.String contents)
public static java.io.Reader newReaderWithContents(java.lang.String contents)
public static java.io.Reader reader(java.io.InputStream stream)
public static java.io.Reader reader(java.io.InputStream stream, java.nio.charset.Charset charset)
public static byte[] readFully(java.io.InputStream is)
readFully(reader(is))
or readFullyString(is)
;
consider using instead;public static int readFully(java.io.InputStream s, byte[] buf) throws java.io.IOException
java.io.IOException
public static byte[] readFullyAndClose(java.io.InputStream is)
public static java.lang.String readFullyString(java.io.InputStream is)
readFullyStringAndClose(InputStream)
instead.public static java.lang.String readFullyStringAndClose(java.io.InputStream is)
public static java.lang.String readFully(java.io.Reader is)
readFullyAndClose(Reader)
instead.public static java.lang.String readFullyAndClose(java.io.Reader is)
public static void copy(java.io.InputStream input, java.io.OutputStream output)
public static void copyClose(java.io.InputStream input, java.io.OutputStream output)
public static void copy(java.io.Reader input, java.io.Writer output)
public static <any> sizeSupplier(java.io.ByteArrayOutputStream src)
public static <any> sizeFunction()
public static java.io.ByteArrayOutputStream byteArrayOfString(java.lang.String in)
public static java.io.ByteArrayOutputStream byteArray(byte[] in)
public static boolean logStreamTail(org.slf4j.Logger log, java.lang.String message, java.io.ByteArrayOutputStream stream, int max)
public static java.lang.String getMd5Checksum(java.io.InputStream in)
public static boolean compare(java.io.InputStream s1, java.io.InputStream s2) throws java.io.IOException
java.io.IOException