|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
net.sf.mmm.util.io.api.EncodingDetectionReader
net.sf.mmm.util.io.base.EncodingUtilImpl.UtfDetectionReader
protected class EncodingUtilImpl.UtfDetectionReader
EncodingUtilImpl.createUtfDetectionReader(InputStream, String)
Field Summary | |
---|---|
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. |
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
EncodingUtilImpl.UtfDetectionReader(InputStream inputStream,
String nonUtfEncoding)
The constructor. |
Method Summary | |
---|---|
void |
close()
|
String |
getEncoding()
This method gets the encoding if already detected. |
int |
read(char[] buffer,
int offset,
int length)
|
Methods inherited from class java.io.Reader |
---|
mark, markSupported, read, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
getEncoding()
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.
Constructor Detail |
---|
public EncodingUtilImpl.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.Method Detail |
---|
public String getEncoding()
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 class Reader
IOException
public int read(char[] buffer, int offset, int length) throws IOException
read
in class Reader
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |