private final class ByteSource.AsCharSource extends CharSource
Modifier and Type | Field and Description |
---|---|
(package private) java.nio.charset.Charset |
charset |
Constructor and Description |
---|
AsCharSource(java.nio.charset.Charset charset) |
Modifier and Type | Method and Description |
---|---|
ByteSource |
asByteSource(java.nio.charset.Charset charset)
Returns a
ByteSource view of this char source that encodes chars read from this source
as bytes using the given Charset . |
java.io.Reader |
openStream()
Opens a new
Reader for reading from this source. |
java.lang.String |
toString() |
concat, concat, concat, copyTo, copyTo, empty, isEmpty, length, lengthIfKnown, openBufferedStream, read, readFirstLine, readLines, readLines, wrap
public ByteSource asByteSource(java.nio.charset.Charset charset)
CharSource
ByteSource
view of this char source that encodes chars read from this source
as bytes using the given Charset
.
If ByteSource.asCharSource(java.nio.charset.Charset)
is called on the returned source with the same charset,
the default implementation of this method will ensure that the original CharSource
is
returned, rather than round-trip encoding. Subclasses that override this method should behave
the same way.
asByteSource
in class CharSource
public java.io.Reader openStream() throws java.io.IOException
CharSource
Reader
for reading from this source. This method should return a new,
independent reader each time it is called.
The caller is responsible for ensuring that the returned reader is closed.
openStream
in class CharSource
java.io.IOException
- if an I/O error occurs in the process of opening the readerpublic java.lang.String toString()
toString
in class java.lang.Object