| Package | Description |
|---|---|
| com.google.common.io |
This package contains utility methods and classes for working with Java I/O,
for example input streams, output streams, readers, writers, and files.
|
| Modifier and Type | Class and Description |
|---|---|
class |
ByteSource
A readable source of bytes, such as a file.
|
class |
CharSource
A readable source of characters, such as a text file.
|
| Modifier and Type | Method and Description |
|---|---|
InputSupplier<java.io.InputStream> |
BaseEncoding.decodingStream(InputSupplier<? extends java.io.Reader> readerSupplier)
Deprecated.
Use
BaseEncoding.decodingSource(CharSource) instead. This method is scheduled to be
removed in Guava 16.0. |
InputSupplier<java.io.InputStream> |
FileBackedOutputStream.getSupplier()
Deprecated.
Use
FileBackedOutputStream.asByteSource() instead. This method is scheduled
to be removed in Guava 16.0. |
static InputSupplier<java.io.InputStream> |
ByteStreams.join(InputSupplier<? extends java.io.InputStream>... suppliers)
Varargs form of
ByteStreams.join(Iterable). |
static InputSupplier<java.io.Reader> |
CharStreams.join(InputSupplier<? extends java.io.Reader>... suppliers)
Varargs form of
CharStreams.join(Iterable). |
static InputSupplier<java.io.InputStream> |
ByteStreams.join(java.lang.Iterable<? extends InputSupplier<? extends java.io.InputStream>> suppliers)
Joins multiple
InputStream suppliers into a single supplier. |
static InputSupplier<java.io.Reader> |
CharStreams.join(java.lang.Iterable<? extends InputSupplier<? extends java.io.Reader>> suppliers)
Joins multiple
Reader suppliers into a single supplier. |
static InputSupplier<java.io.ByteArrayInputStream> |
ByteStreams.newInputStreamSupplier(byte[] b)
Returns a factory that will supply instances of
ByteArrayInputStream that read from the given byte array. |
static InputSupplier<java.io.ByteArrayInputStream> |
ByteStreams.newInputStreamSupplier(byte[] b,
int off,
int len)
Returns a factory that will supply instances of
ByteArrayInputStream that read from the given byte array. |
static InputSupplier<java.io.FileInputStream> |
Files.newInputStreamSupplier(java.io.File file)
Returns a factory that will supply instances of
FileInputStream
that read from a file. |
static InputSupplier<java.io.InputStream> |
Resources.newInputStreamSupplier(java.net.URL url)
Returns a factory that will supply instances of
InputStream that
read from the given URL. |
static InputSupplier<java.io.InputStreamReader> |
Files.newReaderSupplier(java.io.File file,
java.nio.charset.Charset charset)
Returns a factory that will supply instances of
InputStreamReader that read a file using the given character set. |
static InputSupplier<java.io.InputStreamReader> |
CharStreams.newReaderSupplier(InputSupplier<? extends java.io.InputStream> in,
java.nio.charset.Charset charset)
Returns a factory that will supply instances of
InputStreamReader,
using the given InputStream factory and character set. |
static InputSupplier<java.io.StringReader> |
CharStreams.newReaderSupplier(java.lang.String value)
Returns a factory that will supply instances of
StringReader that
read a string value. |
static InputSupplier<java.io.InputStreamReader> |
Resources.newReaderSupplier(java.net.URL url,
java.nio.charset.Charset charset)
Returns a factory that will supply instances of
InputStreamReader that read a URL using the given character set. |
static InputSupplier<java.io.InputStream> |
ByteStreams.slice(InputSupplier<? extends java.io.InputStream> supplier,
long offset,
long length)
Returns an
InputSupplier that returns input streams from the
an underlying supplier, where each stream starts at the given
offset and is limited to the specified number of bytes. |
| Modifier and Type | Method and Description |
|---|---|
static ByteSource |
ByteStreams.asByteSource(InputSupplier<? extends java.io.InputStream> supplier)
Returns a view of the given
InputStream supplier as a
ByteSource. |
static CharSource |
CharStreams.asCharSource(InputSupplier<? extends java.lang.Readable> supplier)
Returns a view of the given
Readable supplier as a
CharSource. |
static void |
Files.copy(InputSupplier<? extends java.io.InputStream> from,
java.io.File to)
Copies to a file all bytes from an
InputStream supplied by a
factory. |
static long |
ByteStreams.copy(InputSupplier<? extends java.io.InputStream> from,
java.io.OutputStream to)
Opens an input stream from the supplier, copies all bytes from the
input to the output, and closes the input stream.
|
static long |
ByteStreams.copy(InputSupplier<? extends java.io.InputStream> from,
OutputSupplier<? extends java.io.OutputStream> to)
Opens input and output streams from the given suppliers, copies all
bytes from the input to the output, and closes the streams.
|
static <R extends java.lang.Readable & java.io.Closeable> |
CharStreams.copy(InputSupplier<R> from,
java.lang.Appendable to)
Opens a
Readable object from the supplier, copies all characters
to the Appendable object, and closes the input. |
static <R extends java.lang.Readable & java.io.Closeable> |
Files.copy(InputSupplier<R> from,
java.io.File to,
java.nio.charset.Charset charset)
Copies to a file all characters from a
Readable and
Closeable object supplied by a factory, using the given
character set. |
static <R extends java.lang.Readable & java.io.Closeable,W extends java.lang.Appendable & java.io.Closeable> |
CharStreams.copy(InputSupplier<R> from,
OutputSupplier<W> to)
Opens
Readable and Appendable objects from the
given factories, copies all characters between the two, and closes
them. |
InputSupplier<java.io.InputStream> |
BaseEncoding.decodingStream(InputSupplier<? extends java.io.Reader> readerSupplier)
Deprecated.
Use
BaseEncoding.decodingSource(CharSource) instead. This method is scheduled to be
removed in Guava 16.0. |
static boolean |
ByteStreams.equal(InputSupplier<? extends java.io.InputStream> supplier1,
InputSupplier<? extends java.io.InputStream> supplier2)
Returns true if the supplied input streams contain the same bytes.
|
static boolean |
ByteStreams.equal(InputSupplier<? extends java.io.InputStream> supplier1,
InputSupplier<? extends java.io.InputStream> supplier2)
Returns true if the supplied input streams contain the same bytes.
|
static HashCode |
ByteStreams.hash(InputSupplier<? extends java.io.InputStream> supplier,
HashFunction hashFunction)
Computes the hash code of the data supplied by
supplier using hashFunction. |
static InputSupplier<java.io.InputStream> |
ByteStreams.join(InputSupplier<? extends java.io.InputStream>... suppliers)
Varargs form of
ByteStreams.join(Iterable). |
static InputSupplier<java.io.Reader> |
CharStreams.join(InputSupplier<? extends java.io.Reader>... suppliers)
Varargs form of
CharStreams.join(Iterable). |
static long |
ByteStreams.length(InputSupplier<? extends java.io.InputStream> supplier)
Returns the length of a supplied input stream, in bytes.
|
static InputSupplier<java.io.InputStreamReader> |
CharStreams.newReaderSupplier(InputSupplier<? extends java.io.InputStream> in,
java.nio.charset.Charset charset)
Returns a factory that will supply instances of
InputStreamReader,
using the given InputStream factory and character set. |
static <T> T |
ByteStreams.readBytes(InputSupplier<? extends java.io.InputStream> supplier,
ByteProcessor<T> processor)
Process the bytes of a supplied stream
|
static <R extends java.lang.Readable & java.io.Closeable> |
CharStreams.readFirstLine(InputSupplier<R> supplier)
Reads the first line from a
Readable & Closeable object
supplied by a factory. |
static <R extends java.lang.Readable & java.io.Closeable> |
CharStreams.readLines(InputSupplier<R> supplier)
Reads all of the lines from a
Readable & Closeable object
supplied by a factory. |
static <R extends java.lang.Readable & java.io.Closeable,T> |
CharStreams.readLines(InputSupplier<R> supplier,
LineProcessor<T> callback)
Streams lines from a
Readable and Closeable object
supplied by a factory, stopping when our callback returns false, or we
have read all of the lines. |
static InputSupplier<java.io.InputStream> |
ByteStreams.slice(InputSupplier<? extends java.io.InputStream> supplier,
long offset,
long length)
Returns an
InputSupplier that returns input streams from the
an underlying supplier, where each stream starts at the given
offset and is limited to the specified number of bytes. |
static byte[] |
ByteStreams.toByteArray(InputSupplier<? extends java.io.InputStream> supplier)
Returns the data from a
InputStream factory as a byte array. |
static <R extends java.lang.Readable & java.io.Closeable> |
CharStreams.toString(InputSupplier<R> supplier)
Returns the characters from a
Readable & Closeable object
supplied by a factory as a String. |
| Modifier and Type | Method and Description |
|---|---|
static InputSupplier<java.io.InputStream> |
ByteStreams.join(java.lang.Iterable<? extends InputSupplier<? extends java.io.InputStream>> suppliers)
Joins multiple
InputStream suppliers into a single supplier. |
static InputSupplier<java.io.Reader> |
CharStreams.join(java.lang.Iterable<? extends InputSupplier<? extends java.io.Reader>> suppliers)
Joins multiple
Reader suppliers into a single supplier. |
Copyright © 2010-2013. All Rights Reserved.