java.io.Closeable
, java.lang.AutoCloseable
public final class EncodedInputStream
extends java.io.InputStream
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 | Description |
---|---|---|
private static int |
BUFFERED_CHAR_LEN |
|
private char[] |
decodedBuffer_ |
|
private java.io.ByteArrayInputStream |
encodedInputStream_ |
|
private PublicBufferOutputStream |
encodedOutputStream_ |
|
private java.io.OutputStreamWriter |
encodedStreamWriter_ |
|
private java.io.Reader |
reader_ |
|
private static java.io.ByteArrayInputStream |
suspendMarker |
|
private static java.nio.charset.Charset |
UTF_16BE |
|
private static java.nio.charset.Charset |
UTF_8 |
Modifier | Constructor | Description |
---|---|---|
private |
EncodedInputStream(java.io.Reader reader,
java.nio.charset.Charset encoding,
int charBufferSize,
int initialByteBufferSize) |
Create an encoded stream for the specified
Reader . |
Modifier and Type | Method | Description |
---|---|---|
int |
available() |
|
void |
close() |
|
(package private) static EncodedInputStream |
createUTF16BEStream(java.io.Reader reader) |
Create a UTF-16BE encoded stream from the given
Reader . |
static EncodedInputStream |
createUTF8Stream(java.io.Reader reader) |
Create a UTF-8 encoded stream from the given
Reader . |
int |
read() |
|
private java.io.ByteArrayInputStream |
reEncode(java.io.Reader reader) |
private static final java.nio.charset.Charset UTF_8
private static final java.nio.charset.Charset UTF_16BE
private static final int BUFFERED_CHAR_LEN
private static final java.io.ByteArrayInputStream suspendMarker
private java.io.Reader reader_
private final char[] decodedBuffer_
private java.io.OutputStreamWriter encodedStreamWriter_
private PublicBufferOutputStream encodedOutputStream_
private java.io.ByteArrayInputStream encodedInputStream_
private EncodedInputStream(java.io.Reader reader, java.nio.charset.Charset encoding, int charBufferSize, int initialByteBufferSize)
Reader
.reader
- the Reader
to read characters fromencoding
- the encoding to use in the encoded streamcharBufferSize
- the size of the char buffer. This is the number
of characters read at once from the Reader
.initialByteBufferSize
- the initial size of the byte buffer.
holding the encoded bytespublic static EncodedInputStream createUTF8Stream(java.io.Reader reader)
Reader
.reader
- the Reader
to read characters from.static EncodedInputStream createUTF16BEStream(java.io.Reader reader)
Reader
.reader
- the Reader
to read characters from.private java.io.ByteArrayInputStream reEncode(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.