public final class CharStreams extends Object
All method parameters must be non-null unless documented otherwise.
Some of the methods in this class take arguments with a generic type of
Readable & Closeable
. A Reader
implements both of
those interfaces. Similarly for Appendable & Closeable
and
Writer
.
Modifier and Type | Class and Description |
---|---|
static class |
CharStreams.LimitedReader |
Modifier and Type | Method and Description |
---|---|
static long |
copy(Readable from,
Appendable to)
Copies all characters between the
Readable and Appendable
objects. |
static Reader |
limit(Reader in,
long n) |
static void |
skipFully(Reader reader,
long n)
Discards
n characters of data from the reader. |
static String |
toString(Readable r)
|
public static long copy(Readable from, Appendable to) throws IOException
Readable
and Appendable
objects. Does not close or flush either object.from
- the object to read fromto
- the object to write toIOException
- if an I/O error occurspublic static String toString(Readable r) throws IOException
r
- the object to read fromIOException
- if an I/O error occurspublic static void skipFully(Reader reader, long n) throws IOException
n
characters of data from the reader. This method
will block until the full amount has been skipped. Does not close the
reader.reader
- the reader to read fromn
- the number of characters to skipEOFException
- if this stream reaches the end before skipping all
the bytesIOException
- if an I/O error occursCopyright © 2013-2015 impossibl.com. All Rights Reserved.