Package org.codehaus.jackson.impl
Class ByteSourceBootstrapper
java.lang.Object
org.codehaus.jackson.impl.ByteSourceBootstrapper
This class is used to determine the encoding of byte stream
that is to contain JSON content. Rules are fairly simple, and
defined in JSON specification (RFC-4627 or newer), except
for BOM handling, which is a property of underlying
streams.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected int
protected final IOContext
protected final InputStream
protected final byte[]
protected int
Current number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer. -
Constructor Summary
ConstructorsConstructorDescriptionByteSourceBootstrapper
(IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen) ByteSourceBootstrapper
(IOContext ctxt, InputStream in) -
Method Summary
Modifier and TypeMethodDescriptionconstructParser
(int features, ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols) Method that should be called after constructing an instace.protected boolean
ensureLoaded
(int minimum) static MatchStrength
Current implementation is not as thorough as other functionality (ByteSourceBootstrapper
); supports UTF-8, for example.
-
Field Details
-
_context
-
_in
-
_inputBuffer
protected final byte[] _inputBuffer -
_inputProcessed
protected int _inputProcessedCurrent number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.Note: includes possible BOMs, if those were part of the input.
-
_bigEndian
protected boolean _bigEndian -
_bytesPerChar
protected int _bytesPerChar
-
-
Constructor Details
-
ByteSourceBootstrapper
-
ByteSourceBootstrapper
-
-
Method Details
-
detectEncoding
Method that should be called after constructing an instace. It will figure out encoding that content uses, to allow for instantiating a proper scanner object.- Throws:
IOException
JsonParseException
-
constructReader
- Throws:
IOException
-
constructParser
public JsonParser constructParser(int features, ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols) throws IOException, JsonParseException - Throws:
IOException
JsonParseException
-
hasJSONFormat
Current implementation is not as thorough as other functionality (ByteSourceBootstrapper
); supports UTF-8, for example. But it should work, for now, and can be improved as necessary.- Throws:
IOException
- Since:
- 1.8
-
ensureLoaded
- Throws:
IOException
-