public final class

ByteSourceJsonBootstrapper

extends Object
java.lang.Object
   ↳ com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper

Class Overview

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.

Summary

Fields
protected boolean _bigEndian
protected int _bytesPerChar
protected final IOContext _context
protected final InputStream _in
protected final byte[] _inputBuffer
protected int _inputProcessed Current number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.
Public Constructors
ByteSourceJsonBootstrapper(IOContext ctxt, InputStream in)
ByteSourceJsonBootstrapper(IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen)
Public Methods
JsonParser constructParser(int parserFeatures, ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols, boolean canonicalize, boolean intern)
Reader constructReader()
JsonEncoding detectEncoding()
Method that should be called after constructing an instace.
static MatchStrength hasJSONFormat(InputAccessor acc)
Current implementation is not as thorough as other functionality (ByteSourceJsonBootstrapper); supports UTF-8, for example.
Protected Methods
boolean ensureLoaded(int minimum)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected boolean _bigEndian

protected int _bytesPerChar

protected final IOContext _context

protected final InputStream _in

protected final byte[] _inputBuffer

protected int _inputProcessed

Current 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.

Public Constructors

public ByteSourceJsonBootstrapper (IOContext ctxt, InputStream in)

public ByteSourceJsonBootstrapper (IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen)

Public Methods

public JsonParser constructParser (int parserFeatures, ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols, boolean canonicalize, boolean intern)

public Reader constructReader ()

Throws
IOException

public JsonEncoding 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.

public static MatchStrength hasJSONFormat (InputAccessor acc)

Current implementation is not as thorough as other functionality (ByteSourceJsonBootstrapper); supports UTF-8, for example. But it should work, for now, and can be improved as necessary.

Throws
IOException

Protected Methods

protected boolean ensureLoaded (int minimum)

Throws
IOException