Reader.
This is an internal class, used to pass readers of characters as streams of
bytes. The characters will be represented according to the specified
encoding. It is up to the caller to ensure the specified encoding is
available, and in general only encodings available as default from Java 1.3
and up should be used.
Currently, the encodings 'UTF8' and 'UTF-16BE' are used.
Streams are obtained by calling the static methods of this class,
for instance createUTF8Stream.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private final char[] | |
| private ByteArrayInputStream | |
| private PublicBufferOutputStream | |
| private OutputStreamWriter | |
| private Reader | |
| private static final ByteArrayInputStream | |
| private static final Charset | |
| private static final Charset |
| Access | Constructor and Description |
|---|---|
| private | EncodedInputStream(Reader
the reader, Charset Reader to read characters fromthe encoding to use in the encoded stream encoding, int the size of the char buffer. This is the number
of characters read at once from the charBufferSize, int Reader.the initial size of the byte buffer.
holding the encoded bytes initialByteBufferSize)Create an encoded stream for the specified |
| Modifier and Type | Method and Description |
|---|---|
| public int | available()
Overrides java. |
| public void | close()
Overrides java. Implements java. |
| pack-priv static EncodedInputStream | Returns: a byte-stream with UTF-16BE encoded charactersthe reader)Reader to read characters from.Create a UTF-16BE encoded stream from the given |
| public static EncodedInputStream | Returns: a byte-stream with UTF-8 encoded charactersthe reader)Reader to read characters from.Create a UTF-8 encoded stream from the given |
| public int | read()
Implements abstract java. |
| private ByteArrayInputStream |
| BUFFERED_CHAR_LEN | back to summary |
|---|---|
| private static final int BUFFERED_CHAR_LEN | |
| decodedBuffer_ | back to summary |
|---|---|
| private final char[] decodedBuffer_ | |
| encodedInputStream_ | back to summary |
|---|---|
| private ByteArrayInputStream encodedInputStream_ | |
| encodedOutputStream_ | back to summary |
|---|---|
| private PublicBufferOutputStream encodedOutputStream_ | |
| encodedStreamWriter_ | back to summary |
|---|---|
| private OutputStreamWriter encodedStreamWriter_ | |
| reader_ | back to summary |
|---|---|
| private Reader reader_ | |
| suspendMarker | back to summary |
|---|---|
| private static final ByteArrayInputStream suspendMarker | |
| UTF_16BE | back to summary |
|---|---|
| private static final Charset UTF_16BE | |
| UTF_8 | back to summary |
|---|---|
| private static final Charset UTF_8 | |
| EncodedInputStream | back to summary |
|---|---|
| private EncodedInputStream(Reader reader, Charset encoding, int charBufferSize, int initialByteBufferSize) Create an encoded stream for the specified
| |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Doc from java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected. The read might be on the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes. Note that while some implementations of A subclass's implementation of this method may choose to throw an
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| createUTF16BEStream | back to summary |
|---|---|
| pack-priv static EncodedInputStream createUTF16BEStream(Reader reader) Create a UTF-16BE encoded stream from the given
| |
| createUTF8Stream | back to summary |
|---|---|
| public static EncodedInputStream createUTF8Stream(Reader reader) Create a UTF-8 encoded stream from the given
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| reEncode | back to summary |
|---|---|
| private ByteArrayInputStream reEncode(Reader reader) throws IOException | |