@CheckReturnValue @ParametersAreNonnullByDefault
Package com.google.common.io
Utility methods and classes for I/O; for example input streams, output streams, readers, writers,
and files.
At the core of this package are the Source/Sink types: ByteSource, CharSource, ByteSink and CharSink. They are
factories for I/O streams that provide many convenience methods that handle both opening and
closing streams for you.
This package is a part of the open-source Guava library. For more information on Sources and Sinks as well as other features of this package, see I/O Explained on the Guava wiki.
- Author:
- Chris Nokleberg
-
Interface Summary Interface Description ByteArrayDataInput An extension ofDataInputfor reading from in-memory byte arrays; its methods offer identical functionality but do not throwIOException.ByteArrayDataOutput An extension ofDataOutputfor writing to in-memory byte arrays; its methods offer identical functionality but do not throwIOException.ByteProcessor<T extends @Nullable java.lang.Object> A callback interface to process bytes from a stream.LineProcessor<T extends @Nullable java.lang.Object> A callback to be used with the streamingreadLinesmethods. -
Class Summary Class Description BaseEncoding A binary encoding scheme for reversibly translating between byte sequences and printable ASCII strings.ByteSink A destination to which bytes can be written, such as a file.ByteSource A readable source of bytes, such as a file.ByteStreams Provides utility methods for working with byte arrays and I/O streams.CharSink A destination to which characters can be written, such as a text file.CharSource A readable source of characters, such as a text file.CharStreams Provides utility methods for working with character streams.Closeables Utility methods for working withCloseableobjects.Closer CountingInputStream AnInputStreamthat counts the number of bytes read.CountingOutputStream An OutputStream that counts the number of bytes written.FileBackedOutputStream AnOutputStreamthat starts buffering to a byte array, but switches to file buffering once the data reaches a configurable size.Files Provides utility methods for working with files.Flushables Utility methods for working withFlushableobjects.LineReader A class for reading lines of text.LittleEndianDataInputStream An implementation ofDataInputthat uses little-endian byte ordering for readingshort,int,float,double, andlongvalues.LittleEndianDataOutputStream An implementation ofDataOutputthat uses little-endian byte ordering for writingchar,short,int,float,double, andlongvalues.MoreFiles Static utilities for use withPathinstances, intended to complementFiles.PatternFilenameFilter File name filter that only accepts files matching a regular expression.Resources Provides utility methods for working with resources in the classpath. -
Enum Summary Enum Description FileWriteMode Modes for opening a file for writing.RecursiveDeleteOption Options for use with recursive delete methods (MoreFiles.deleteRecursively(java.nio.file.Path, com.google.common.io.RecursiveDeleteOption...)andMoreFiles.deleteDirectoryContents(java.nio.file.Path, com.google.common.io.RecursiveDeleteOption...)). -
Exception Summary Exception Description BaseEncoding.DecodingException Exception indicating invalid base-encoded input encountered while decoding.InsecureRecursiveDeleteException Exception indicating that a recursive delete can't be performed because the file system does not have the support necessary to guarantee that it is not vulnerable to race conditions that would allow it to delete files and directories outside of the directory being deleted (i.e.,SecureDirectoryStreamis not supported).