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 |
ByteSink
A destination to which bytes can be written, such as a file.
|
class |
CharSink
A destination to which characters can be written, such as a text file.
|
Modifier and Type | Method and Description |
---|---|
OutputSupplier<OutputStream> |
BaseEncoding.encodingStream(OutputSupplier<? extends Writer> writerSupplier)
Deprecated.
Use
BaseEncoding.encodingSink(CharSink) instead. This method is scheduled to be
removed in Guava 16.0. |
static OutputSupplier<FileOutputStream> |
Files.newOutputStreamSupplier(File file)
Returns a factory that will supply instances of
FileOutputStream
that write to a file. |
static OutputSupplier<FileOutputStream> |
Files.newOutputStreamSupplier(File file,
boolean append)
Returns a factory that will supply instances of
FileOutputStream
that write to or append to a file. |
static OutputSupplier<OutputStreamWriter> |
Files.newWriterSupplier(File file,
Charset charset)
Returns a factory that will supply instances of
OutputStreamWriter
that write to a file using the given character set. |
static OutputSupplier<OutputStreamWriter> |
Files.newWriterSupplier(File file,
Charset charset,
boolean append)
Returns a factory that will supply instances of
OutputStreamWriter
that write to or append to a file using the given character set. |
static OutputSupplier<OutputStreamWriter> |
CharStreams.newWriterSupplier(OutputSupplier<? extends OutputStream> out,
Charset charset)
Returns a factory that will supply instances of
OutputStreamWriter ,
using the given OutputStream factory and character set. |
Modifier and Type | Method and Description |
---|---|
static ByteSink |
ByteStreams.asByteSink(OutputSupplier<? extends OutputStream> supplier)
Returns a view of the given
OutputStream supplier as a
ByteSink . |
static CharSink |
CharStreams.asCharSink(OutputSupplier<? extends Appendable> supplier)
Returns a view of the given
Appendable supplier as a
CharSink . |
static <W extends Appendable & Closeable> |
Files.copy(File from,
Charset charset,
OutputSupplier<W> to)
Copies all characters from a file to a
Appendable &
Closeable object supplied by a factory, using the given
character set. |
static void |
Files.copy(File from,
OutputSupplier<? extends OutputStream> to)
Copies all bytes from a file to an
OutputStream supplied by
a factory. |
static long |
ByteStreams.copy(InputStream from,
OutputSupplier<? extends OutputStream> to)
Opens an output stream from the supplier, copies all bytes from the input
to the output, and closes the output 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,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. |
OutputSupplier<OutputStream> |
BaseEncoding.encodingStream(OutputSupplier<? extends Writer> writerSupplier)
Deprecated.
Use
BaseEncoding.encodingSink(CharSink) instead. This method is scheduled to be
removed in Guava 16.0. |
static OutputSupplier<OutputStreamWriter> |
CharStreams.newWriterSupplier(OutputSupplier<? extends OutputStream> out,
Charset charset)
Returns a factory that will supply instances of
OutputStreamWriter ,
using the given OutputStream factory and character set. |
static void |
ByteStreams.write(byte[] from,
OutputSupplier<? extends OutputStream> to)
Writes a byte array to an output stream from the given supplier.
|
static <W extends Appendable & Closeable> |
CharStreams.write(CharSequence from,
OutputSupplier<W> to)
Writes a character sequence (such as a string) to an appendable
object from the given supplier.
|
Copyright © 2010-2013. All Rights Reserved.