protected class EncodingUtilImpl.UtfDetectionReader extends EncodingDetectionReader
Modifier and Type | Field and Description |
---|---|
private int |
asciiBytesAvailable
The number of ASCII bytes available to read from
inputStream . |
private EncodingUtilImpl.AsciiProcessor |
asciiProcessor
The processor for ASCII-mode.
|
private static int |
BUFFER_SIZE
The used buffer size.
|
private ProcessableByteArrayBuffer |
detectionBuffer
The lookahead buffer used to detect encoding.
|
private EncodingUtilImpl.UtfDetectionProcessor |
detectionProcessor
The processor to detect encoding by lookahead.
|
private String |
encoding |
private boolean |
eos
true if end of stream is reached. |
private BufferInputStream |
inputStream
The input-stream to read.
|
private Reader |
reader
The
Reader to delegate to. |
private static int |
REQUIRED_LOOKAHEAD
The required lookahead size.
|
Constructor and Description |
---|
UtfDetectionReader(InputStream inputStream,
String nonUtfEncoding)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
String |
getEncoding()
This method gets the encoding if already detected.
|
int |
read(char[] buffer,
int offset,
int length) |
private static final int REQUIRED_LOOKAHEAD
private static final int BUFFER_SIZE
private final BufferInputStream inputStream
private final EncodingUtilImpl.AsciiProcessor asciiProcessor
private final EncodingUtilImpl.UtfDetectionProcessor detectionProcessor
private final ProcessableByteArrayBuffer detectionBuffer
private String encoding
private Reader reader
Reader
to delegate to. Will be null
until the first non ASCII-Character is
detected.private int asciiBytesAvailable
inputStream
.private boolean eos
true
if end of stream is reached.public UtfDetectionReader(InputStream inputStream, String nonUtfEncoding)
inputStream
- is the InputStream
to read.nonUtfEncoding
- is the encoding to use as fallback if non-ASCII characters are detected that are
NOT encoded in UTF.public String getEncoding()
EncodingDetectionReader
Reader
has
been reached.getEncoding
in class EncodingDetectionReader
null
if NOT yet detected (then typically
ASCII
is assumed so far).public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Reader
IOException
public int read(char[] buffer, int offset, int length) throws IOException
read
in class Reader
IOException
Copyright © 2001–2016 mmm-Team. All rights reserved.