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 |
read()
Reads the contents of this source as a string.
|
java.lang.String |
toString() |
concat, concat, concat, copyTo, copyTo, empty, forEachLine, isEmpty, length, lengthIfKnown, lines, openBufferedStream, readFirstLine, readLines, readLines, wrappublic ByteSource asByteSource(java.nio.charset.Charset charset)
CharSourceByteSource 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 CharSourcepublic java.io.Reader openStream()
throws java.io.IOException
CharSourceReader for reading from this source. This method returns a new, independent
reader each time it is called.
The caller is responsible for ensuring that the returned reader is closed.
openStream in class CharSourcejava.io.IOException - if an I/O error occurs while opening the readerpublic java.lang.String read()
throws java.io.IOException
CharSourceread in class CharSourcejava.io.IOException - if an I/O error occurs while reading from this sourcepublic java.lang.String toString()
toString in class java.lang.Object