private final class CharSource.AsByteSource extends ByteSource
ByteSource.AsCharSource
Modifier and Type | Field and Description |
---|---|
(package private) java.nio.charset.Charset |
charset |
Constructor and Description |
---|
AsByteSource(java.nio.charset.Charset charset) |
Modifier and Type | Method and Description |
---|---|
CharSource |
asCharSource(java.nio.charset.Charset charset)
Returns a
CharSource view of this byte source that decodes bytes read from this source
as characters using the given Charset . |
java.io.InputStream |
openStream()
Opens a new
InputStream for reading from this source. |
java.lang.String |
toString() |
concat, concat, concat, contentEquals, copyTo, copyTo, empty, hash, isEmpty, openBufferedStream, read, read, size, sizeIfKnown, slice, wrap
public CharSource asCharSource(java.nio.charset.Charset charset)
ByteSource
CharSource
view of this byte source that decodes bytes read from this source
as characters using the given Charset
.
If CharSource.asByteSource(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 ByteSource
is
returned, rather than round-trip encoding. Subclasses that override this method should behave
the same way.
asCharSource
in class ByteSource
public java.io.InputStream openStream() throws java.io.IOException
ByteSource
InputStream
for reading from this source. This method returns a new,
independent stream each time it is called.
The caller is responsible for ensuring that the returned stream is closed.
openStream
in class ByteSource
java.io.IOException
- if an I/O error occurs while opening the streampublic java.lang.String toString()
toString
in class java.lang.Object