ByteSourceJsonBootstrapper (Jackson-core 2.11.0.rc1 API)
Date: 2020-03-24

com.fasterxml.jackson.core.json

## Class ByteSourceJsonBootstrapper

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

-     public final class ByteSourceJsonBootstrapper
      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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static byte` | `UTF8_BOM_1`
    `static byte` | `UTF8_BOM_2`
    `static byte` | `UTF8_BOM_3`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `JsonParser` | `constructParser(int parserFeatures, ObjectCodec codec, ByteQuadsCanonicalizer rootByteSymbols, CharsToNameCanonicalizer rootCharSymbols, int factoryFeatures)`
    `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(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`

- - ### Field Detail

    - #### UTF8_BOM_1

          public static final byte UTF8_BOM_1

      See Also:
        Constant Field Values

    - #### UTF8_BOM_2

          public static final byte UTF8_BOM_2

      See Also:
        Constant Field Values

    - #### UTF8_BOM_3

          public static final byte UTF8_BOM_3

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ByteSourceJsonBootstrapper

          public ByteSourceJsonBootstrapper(IOContext ctxt,
                                            InputStream in)

    - #### ByteSourceJsonBootstrapper

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

  - ### Method Detail

    - #### detectEncoding

          public JsonEncoding detectEncoding()
                                      throws 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:
        `IOException`

    - #### skipUTF8BOM

          public static int skipUTF8BOM(DataInput input)
                                 throws IOException

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

    - #### constructReader

          public Reader constructReader()
                                 throws IOException

      Throws:
        `IOException`

    - #### constructParser

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

      Throws:
        `IOException`

    - #### hasJSONFormat

          public static MatchStrength hasJSONFormat(InputAccessor acc)
                                             throws 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:
        `IOException`

    - #### ensureLoaded

          protected boolean ensureLoaded(int minimum)
                                  throws IOException

      Throws:
        `IOException`

Copyright © 2008–2020 FasterXML. All rights reserved.