public class Streams
extends java.lang.Object
ByteStreams
,
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 void |
copy(java.io.InputStream input,
java.io.OutputStream output) |
static void |
copy(java.io.Reader input,
java.io.Writer output) |
static java.io.InputStream |
fromString(java.lang.String contents)
Deprecated.
since 0.7.0 use
newInputStreamWithContents(String) |
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) |
static java.lang.String |
readFully(java.io.Reader is) |
static java.lang.String |
readFullyString(java.io.InputStream is) |
static com.google.common.base.Function<java.io.ByteArrayOutputStream,java.lang.Integer> |
sizeFunction() |
static com.google.common.base.Supplier<java.lang.Integer> |
sizeSupplier(java.io.ByteArrayOutputStream src) |
@Beta 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 method@Deprecated public static java.io.InputStream fromString(java.lang.String contents)
newInputStreamWithContents(String)
public 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)
public static java.lang.String readFullyString(java.io.InputStream is)
public static java.lang.String readFully(java.io.Reader is)
public static void copy(java.io.InputStream input, java.io.OutputStream output)
public static void copy(java.io.Reader input, java.io.Writer output)
public static com.google.common.base.Supplier<java.lang.Integer> sizeSupplier(java.io.ByteArrayOutputStream src)
public static com.google.common.base.Function<java.io.ByteArrayOutputStream,java.lang.Integer> 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)