Package org.apache.camel.jsonpath
Class JsonStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.camel.jsonpath.JsonStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class JsonStream extends FilterInputStream
Special stream for JSON streams. Determines from the first 4 bytes the JSON encoding according to JSON specification RFC-4627 or newer. In addition BOMs are taken into account.This class is not thread safe.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description JsonStream(InputStream in)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CharsetgetEncoding()booleanmarkSupported()intread()intread(byte[] b)intread(byte[] b, int off, int len)voidreset()longskip(long n)-
Methods inherited from class java.io.FilterInputStream
available, close, mark
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
JsonStream
public JsonStream(InputStream in) throws IOException
Constructor. Determines the encoding during the instantiation according to JSON specification RFC-4627 or newer. In addition BOMs are taken into account.- Parameters:
in- input stream must contain a JSON content- Throws:
IOException- if an error occurs during the determination of the encodingCharConversionException- if the UCS4 endianess 2143 or 3412 is usedIllegalArgumentException- if the input stream isnull
-
-
Method Detail
-
getEncoding
public Charset getEncoding()
-
read
public int read() throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classFilterInputStream
-
-