Package org.glassfish.json
Class UnicodeDetectingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.glassfish.json.UnicodeDetectingInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
class UnicodeDetectingInputStream extends java.io.FilterInputStream
A filter stream that detects the unicode encoding for the original stream
-
-
Field Summary
Fields Modifier and Type Field Description private static byte
BB
private static byte
BF
private byte[]
buf
private int
bufLen
private java.nio.charset.Charset
charset
private int
curIndex
private static byte
EF
private static byte
FE
private static byte
FF
private static byte
NUL
private static java.nio.charset.Charset
UTF_32BE
private static java.nio.charset.Charset
UTF_32LE
-
Constructor Summary
Constructors Constructor Description UnicodeDetectingInputStream(java.io.InputStream is)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.nio.charset.Charset
detectEncoding()
private void
fillBuf()
(package private) java.nio.charset.Charset
getCharset()
int
read()
int
read(byte[] b, int off, int len)
-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
-
-
-
-
Field Detail
-
UTF_32LE
private static final java.nio.charset.Charset UTF_32LE
-
UTF_32BE
private static final java.nio.charset.Charset UTF_32BE
-
FF
private static final byte FF
- See Also:
- Constant Field Values
-
FE
private static final byte FE
- See Also:
- Constant Field Values
-
EF
private static final byte EF
- See Also:
- Constant Field Values
-
BB
private static final byte BB
- See Also:
- Constant Field Values
-
BF
private static final byte BF
- See Also:
- Constant Field Values
-
NUL
private static final byte NUL
- See Also:
- Constant Field Values
-
buf
private final byte[] buf
-
bufLen
private int bufLen
-
curIndex
private int curIndex
-
charset
private final java.nio.charset.Charset charset
-
-
Method Detail
-
getCharset
java.nio.charset.Charset getCharset()
-
fillBuf
private void fillBuf()
-
detectEncoding
private java.nio.charset.Charset detectEncoding()
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-