org.codehaus.jackson.impl
Class ByteSourceBootstrapper

java.lang.Object
  extended by org.codehaus.jackson.impl.ByteSourceBootstrapper

public final class ByteSourceBootstrapper
extends Object

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
protected  int _inputProcessed
          Current number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.
 
Constructor Summary
ByteSourceBootstrapper(IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen)
           
ByteSourceBootstrapper(IOContext ctxt, InputStream in)
           
 
Method Summary
 JsonParser constructParser(int features, ObjectCodec codec, BytesToNameCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols)
           
 Reader constructReader()
           
 JsonEncoding detectEncoding()
          Method that should be called after constructing an instace.
protected  boolean ensureLoaded(int minimum)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_inputProcessed

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.

Constructor Detail

ByteSourceBootstrapper

public ByteSourceBootstrapper(IOContext ctxt,
                              InputStream in)

ByteSourceBootstrapper

public ByteSourceBootstrapper(IOContext ctxt,
                              byte[] inputBuffer,
                              int inputStart,
                              int inputLen)
Method Detail

detectEncoding

public JsonEncoding detectEncoding()
                            throws IOException,
                                   JsonParseException
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

public Reader constructReader()
                       throws IOException
Throws:
IOException

constructParser

public JsonParser constructParser(int features,
                                  ObjectCodec codec,
                                  BytesToNameCanonicalizer rootByteSymbols,
                                  CharsToNameCanonicalizer rootCharSymbols)
                           throws IOException,
                                  JsonParseException
Throws:
IOException
JsonParseException

ensureLoaded

protected boolean ensureLoaded(int minimum)
                        throws IOException
Throws:
IOException