ByteSourceJsonBootstrapper
Date: 2016-12-03

com.fasterxml.jackson.core.json

## Class ByteSourceJsonBootstrapper

- java.lang.Object
- - com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper

-     public final class ByteSourceJsonBootstrapper
      extends java.lang.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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteSourceJsonBootstrapper(IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen)`
    `ByteSourceJsonBootstrapper(IOContext ctxt, java.io.InputStream in)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `JsonParser` | `constructParser(int parserFeatures, ObjectCodec codec, ByteQuadsCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols, int factoryFeatures)`
    `java.io.Reader` | `constructReader()`
    `JsonEncoding` | `detectEncoding()` Method that should be called after constructing an instace.
    `protected boolean` | `ensureLoaded(int minimum)`
    `static MatchStrength` | `hasJSONFormat(InputAccessor acc)` Current implementation is not as thorough as other functionality (`ByteSourceJsonBootstrapper`); supports UTF-8, for example.
    `static int` | `skipUTF8BOM(java.io.DataInput input)` Helper method that may be called to see if given `DataInput` has BOM marker, and if so, to skip it.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ByteSourceJsonBootstrapper

          public ByteSourceJsonBootstrapper(IOContext ctxt,
                                    java.io.InputStream in)

    - #### ByteSourceJsonBootstrapper

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

  - ### Method Detail

    - #### detectEncoding

          public JsonEncoding detectEncoding()
                                      throws java.io.IOException

      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:
        `java.io.IOException`

    - #### skipUTF8BOM

          public static int skipUTF8BOM(java.io.DataInput input)
                                 throws java.io.IOException

      Helper method that may be called to see if given `DataInput` has BOM marker, and if so, to skip it.
      Throws:
        `java.io.IOException`
      Since:
        2.8

    - #### constructReader

          public java.io.Reader constructReader()
                                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### constructParser

          public JsonParser constructParser(int parserFeatures,
                                   ObjectCodec codec,
                                   ByteQuadsCanonicalizer rootByteSymbols,
                                   CharsToNameCanonicalizer rootCharSymbols,
                                   int factoryFeatures)
                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### hasJSONFormat

          public static MatchStrength hasJSONFormat(InputAccessor acc)
                                             throws java.io.IOException

      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:
        `java.io.IOException`

    - #### ensureLoaded

          protected boolean ensureLoaded(int minimum)
                                  throws java.io.IOException

      Throws:
        `java.io.IOException`