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<InputStream> |
BaseEncoding.decodingStream(InputSupplier<? extends Reader> readerSupplier)
Deprecated.
Use
BaseEncoding.decodingSource(CharSource) instead. This method is scheduled to be
removed in Guava 16.0. |
InputSupplier<InputStream> |
FileBackedOutputStream.getSupplier()
Deprecated.
Use
FileBackedOutputStream.asByteSource() instead. This method is scheduled
to be removed in Guava 16.0. |
static InputSupplier<InputStream> |
ByteStreams.join(InputSupplier<? extends InputStream>... suppliers)
Varargs form of
ByteStreams.join(Iterable) . |
static InputSupplier<Reader> |
CharStreams.join(InputSupplier<? extends Reader>... suppliers)
Varargs form of
CharStreams.join(Iterable) . |
static InputSupplier<InputStream> |
ByteStreams.join(Iterable<? extends InputSupplier<? extends InputStream>> suppliers)
Joins multiple
InputStream suppliers into a single supplier. |
static InputSupplier<Reader> |
CharStreams.join(Iterable<? extends InputSupplier<? extends Reader>> suppliers)
Joins multiple
Reader suppliers into a single supplier. |
static InputSupplier<ByteArrayInputStream> |
ByteStreams.newInputStreamSupplier(byte[] b)
Returns a factory that will supply instances of
ByteArrayInputStream that read from the given byte array. |
static InputSupplier<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<FileInputStream> |
Files.newInputStreamSupplier(File file)
Returns a factory that will supply instances of
FileInputStream
that read from a file. |
static InputSupplier<InputStream> |
Resources.newInputStreamSupplier(URL url)
Returns a factory that will supply instances of
InputStream that
read from the given URL. |
static InputSupplier<InputStreamReader> |
Files.newReaderSupplier(File file,
Charset charset)
Returns a factory that will supply instances of
InputStreamReader that read a file using the given character set. |
static InputSupplier<InputStreamReader> |
CharStreams.newReaderSupplier(InputSupplier<? extends InputStream> in,
Charset charset)
Returns a factory that will supply instances of
InputStreamReader ,
using the given InputStream factory and character set. |
static InputSupplier<StringReader> |
CharStreams.newReaderSupplier(String value)
Returns a factory that will supply instances of
StringReader that
read a string value. |
static InputSupplier<InputStreamReader> |
Resources.newReaderSupplier(URL url,
Charset charset)
Returns a factory that will supply instances of
InputStreamReader that read a URL using the given character set. |
static InputSupplier<InputStream> |
ByteStreams.slice(InputSupplier<? extends 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 InputStream> supplier)
Returns a view of the given
InputStream supplier as a
ByteSource . |
static CharSource |
CharStreams.asCharSource(InputSupplier<? extends Readable> supplier)
Returns a view of the given
Readable supplier as a
CharSource . |
static void |
Files.copy(InputSupplier<? extends InputStream> from,
File to)
Copies to a file all bytes from an
InputStream supplied by a
factory. |
static long |
ByteStreams.copy(InputSupplier<? extends InputStream> from,
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 InputStream> from,
OutputSupplier<? extends 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 Readable & Closeable> |
CharStreams.copy(InputSupplier<R> from,
Appendable to)
Opens a
Readable object from the supplier, copies all characters
to the Appendable object, and closes the input. |
static <R extends Readable & Closeable> |
Files.copy(InputSupplier<R> from,
File to,
Charset charset)
|
static <R extends Readable & Closeable,W extends Appendable & 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<InputStream> |
BaseEncoding.decodingStream(InputSupplier<? extends 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 InputStream> supplier1,
InputSupplier<? extends InputStream> supplier2)
Returns true if the supplied input streams contain the same bytes.
|
static boolean |
ByteStreams.equal(InputSupplier<? extends InputStream> supplier1,
InputSupplier<? extends InputStream> supplier2)
Returns true if the supplied input streams contain the same bytes.
|
static HashCode |
ByteStreams.hash(InputSupplier<? extends InputStream> supplier,
HashFunction hashFunction)
Computes the hash code of the data supplied by
supplier using hashFunction . |
static InputSupplier<InputStream> |
ByteStreams.join(InputSupplier<? extends InputStream>... suppliers)
Varargs form of
ByteStreams.join(Iterable) . |
static InputSupplier<Reader> |
CharStreams.join(InputSupplier<? extends Reader>... suppliers)
Varargs form of
CharStreams.join(Iterable) . |
static long |
ByteStreams.length(InputSupplier<? extends InputStream> supplier)
Returns the length of a supplied input stream, in bytes.
|
static InputSupplier<InputStreamReader> |
CharStreams.newReaderSupplier(InputSupplier<? extends InputStream> in,
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 InputStream> supplier,
ByteProcessor<T> processor)
Process the bytes of a supplied stream
|
static <R extends Readable & Closeable> |
CharStreams.readFirstLine(InputSupplier<R> supplier)
|
static <R extends Readable & Closeable> |
CharStreams.readLines(InputSupplier<R> supplier)
|
static <R extends Readable & Closeable,T> |
CharStreams.readLines(InputSupplier<R> supplier,
LineProcessor<T> callback)
|
static InputSupplier<InputStream> |
ByteStreams.slice(InputSupplier<? extends 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 InputStream> supplier)
Returns the data from a
InputStream factory as a byte array. |
static <R extends Readable & Closeable> |
CharStreams.toString(InputSupplier<R> supplier)
|
Modifier and Type | Method and Description |
---|---|
static InputSupplier<InputStream> |
ByteStreams.join(Iterable<? extends InputSupplier<? extends InputStream>> suppliers)
Joins multiple
InputStream suppliers into a single supplier. |
static InputSupplier<Reader> |
CharStreams.join(Iterable<? extends InputSupplier<? extends Reader>> suppliers)
Joins multiple
Reader suppliers into a single supplier. |
Copyright © 2010-2013. All Rights Reserved.