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 Charset
getEncoding()
boolean
markSupported()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
void
reset()
long
skip(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:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classFilterInputStream
-
-