Class JSONReader

java.lang.Object
com.alibaba.fastjson2.JSONReader
All Implemented Interfaces:
Closeable, AutoCloseable

public abstract class JSONReader extends Object implements Closeable
JSONReader is the core class for reading and parsing JSON data in FASTJSON2. It provides methods to read various data types from JSON including primitives, objects, arrays, dates, and custom types.

JSONReader supports multiple input sources including strings, byte arrays, streams, and readers. It also supports different character encodings such as UTF-8, UTF-16, and ASCII.

Example usage:

 String json = "{\"name\":\"John\", \"age\":30}";
 try (JSONReader reader = JSONReader.of(json)) {
     JSONObject obj = reader.readObject();
     String name = (String) obj.get("name");
     Integer age = (Integer) obj.get("age");
 }
 
Since:
2.0.0
  • Field Details

    • context

      protected final JSONReader.Context context
    • jsonb

      public final boolean jsonb
    • utf8

      public final boolean utf8
    • offset

      protected int offset
    • ch

      protected char ch
    • comma

      protected boolean comma
    • nameEscape

      protected boolean nameEscape
    • valueEscape

      protected boolean valueEscape
    • wasNull

      protected boolean wasNull
    • boolValue

      protected boolean boolValue
    • negative

      protected boolean negative
    • valueType

      protected byte valueType
    • exponent

      protected short exponent
    • scale

      protected short scale
    • mag0

      protected int mag0
    • mag1

      protected int mag1
    • mag2

      protected int mag2
    • mag3

      protected int mag3
    • level

      protected int level
    • stringValue

      protected String stringValue
    • complex

      protected Object complex
    • typeRedirect

      protected boolean typeRedirect
    • doubleChars

      protected byte[] doubleChars
    • MASK_FIELD_BASED

      protected static final long MASK_FIELD_BASED
      See Also:
    • MASK_IGNORE_NONE_SERIALIZABLE

      protected static final long MASK_IGNORE_NONE_SERIALIZABLE
      See Also:
    • MASK_ERROR_ON_NONE_SERIALIZABLE

      protected static final long MASK_ERROR_ON_NONE_SERIALIZABLE
      See Also:
    • MASK_SUPPORT_ARRAY_TO_BEAN

      protected static final long MASK_SUPPORT_ARRAY_TO_BEAN
      See Also:
    • MASK_INIT_STRING_FIELD_AS_EMPTY

      protected static final long MASK_INIT_STRING_FIELD_AS_EMPTY
      See Also:
    • MASK_SUPPORT_AUTO_TYPE

      protected static final long MASK_SUPPORT_AUTO_TYPE
      See Also:
    • MASK_SUPPORT_SMART_MATCH

      protected static final long MASK_SUPPORT_SMART_MATCH
      See Also:
    • MASK_TRIM_STRING

      protected static final long MASK_TRIM_STRING
      See Also:
    • MASK_ALLOW_UN_QUOTED_FIELD_NAMES

      protected static final long MASK_ALLOW_UN_QUOTED_FIELD_NAMES
      See Also:
    • MASK_EMPTY_STRING_AS_NULL

      protected static final long MASK_EMPTY_STRING_AS_NULL
      See Also:
    • MASK_DISABLE_SINGLE_QUOTE

      protected static final long MASK_DISABLE_SINGLE_QUOTE
      See Also:
    • MASK_DISABLE_REFERENCE_DETECT

      protected static final long MASK_DISABLE_REFERENCE_DETECT
      See Also:
  • Constructor Details

    • JSONReader

      public JSONReader(JSONReader.Context context, boolean jsonb, boolean utf8)
      Constructs a new JSONReader with the specified context and configuration.
      Parameters:
      context - the reading context to use
      jsonb - whether to use JSONB binary format
      utf8 - whether to use UTF-8 encoding
      Since:
      2.0.51
  • Method Details

    • current

      public final char current()
      Gets the current character being processed by the reader.
      Returns:
      The current character
    • isEnd

      public boolean isEnd()
      Checks if the reader has reached the end of the input.
      Returns:
      true if at the end of input, false otherwise
    • getType

      public byte getType()
      Gets the type of the current JSON value. This method returns a byte value representing the type of the current JSON value being processed by the reader.
      Returns:
      The type of the current JSON value, or -128 if not applicable
      Since:
      2.0.51
    • isInt

      public boolean isInt()
      Checks if the current character represents the start of an integer value.
      Returns:
      true if the current character is '-', '+', or a digit, false otherwise
    • isNull

      public abstract boolean isNull()
      Checks if the current JSON value is null.
      Returns:
      true if the current value is null, false otherwise
    • hasComma

      public final boolean hasComma()
      Checks if the reader has encountered a comma.
      Returns:
      true if a comma was encountered, false otherwise
    • readNullOrNewDate

      public abstract Date readNullOrNewDate()
      Reads a Date value from JSON data, returning null if the value is null.
      Returns:
      The Date value, or null if the value is null in JSON
    • nextIfNull

      public abstract boolean nextIfNull()
      Checks if the current JSON value is null and advances the reader if it is.
      Returns:
      true if the current value is null, false otherwise
    • getContext

      public final JSONReader.Context getContext()
      Gets the reading context for this JSONReader.
      Returns:
      The Context object
    • errorOnNoneSerializable

      public final void errorOnNoneSerializable(Class objectClass)
      Throws a JSONException if the specified class is not serializable and the ErrorOnNoneSerializable feature is enabled.
      Parameters:
      objectClass - The class to check for serializability
      Throws:
      JSONException - if the class is not serializable and the feature is enabled
    • isEnabled

      public final boolean isEnabled(JSONReader.Feature feature)
      Checks if a specific feature is enabled in the reading context.
      Parameters:
      feature - The feature to check
      Returns:
      true if the feature is enabled, false otherwise
    • getLocale

      public final Locale getLocale()
      Gets the locale used for parsing in this JSONReader.
      Returns:
      The Locale object
    • getZoneId

      public final ZoneId getZoneId()
      Gets the zone ID used for date/time parsing in this JSONReader.
      Returns:
      The ZoneId object
    • features

      public final long features(long features)
      Combines the context features with the specified additional features.
      Parameters:
      features - Additional features to combine with context features
      Returns:
      The combined features bitmask
    • getRawInt

      public abstract int getRawInt()
      Gets the raw integer value from the current position in the JSON data.
      Returns:
      The raw integer value
    • getRawLong

      public abstract long getRawLong()
      Gets the raw long value from the current position in the JSON data.
      Returns:
      The raw long value
    • nextIfName4Match2

      public abstract boolean nextIfName4Match2()
      Checks if the next field name matches a 2-character pattern. This method is used for optimized field name matching in JSONB format.
      Returns:
      true if the field name matches the 2-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match2

      public boolean nextIfValue4Match2()
      Checks if the next value matches a 2-character pattern. This method is used for optimized value matching in JSONB format.
      Returns:
      true if the value matches the 2-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match3

      public abstract boolean nextIfName4Match3()
      Checks if the next field name matches a 3-character pattern. This method is used for optimized field name matching in JSONB format.
      Returns:
      true if the field name matches the 3-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match3

      public boolean nextIfValue4Match3()
      Checks if the next value matches a 3-character pattern. This method is used for optimized value matching in JSONB format.
      Returns:
      true if the value matches the 3-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match4

      public abstract boolean nextIfName4Match4(byte c4)
      Checks if the next field name matches a 4-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      c4 - the fourth character to match
      Returns:
      true if the field name matches the 4-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match4

      public boolean nextIfValue4Match4(byte c4)
      Checks if the next value matches a 4-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      c4 - the fourth character to match
      Returns:
      true if the value matches the 4-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match5

      public abstract boolean nextIfName4Match5(int name1)
      Checks if the next field name matches a 5-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      Returns:
      true if the field name matches the 5-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match5

      public boolean nextIfValue4Match5(byte c4, byte c5)
      Checks if the next value matches a 5-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      c4 - the fourth character to match
      c5 - the fifth character to match
      Returns:
      true if the value matches the 5-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match6

      public abstract boolean nextIfName4Match6(int name1)
      Checks if the next field name matches a 6-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      Returns:
      true if the field name matches the 6-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match6

      public boolean nextIfValue4Match6(int name1)
      Checks if the next value matches a 6-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      Returns:
      true if the value matches the 6-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match7

      public abstract boolean nextIfName4Match7(int name1)
      Checks if the next field name matches a 7-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      Returns:
      true if the field name matches the 7-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match7

      public boolean nextIfValue4Match7(int name1)
      Checks if the next value matches a 7-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      Returns:
      true if the value matches the 7-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match8

      public abstract boolean nextIfName4Match8(int name1, byte c8)
      Checks if the next field name matches an 8-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      c8 - the eighth character to match
      Returns:
      true if the field name matches the 8-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match8

      public boolean nextIfValue4Match8(int name1, byte c8)
      Checks if the next value matches an 8-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      c8 - the eighth character to match
      Returns:
      true if the value matches the 8-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match9

      public abstract boolean nextIfName4Match9(long name1)
      Checks if the next field name matches a 9-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      Returns:
      true if the field name matches the 9-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match9

      public boolean nextIfValue4Match9(int name1, byte c8, byte c9)
      Checks if the next value matches a 9-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      name1 - the first 4 bytes of the name to match
      c8 - the eighth character to match
      c9 - the ninth character to match
      Returns:
      true if the value matches the 9-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match10

      public abstract boolean nextIfName4Match10(long name1)
      Checks if the next field name matches a 10-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      Returns:
      true if the field name matches the 10-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match10

      public boolean nextIfValue4Match10(long name1)
      Checks if the next value matches a 10-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      Returns:
      true if the value matches the 10-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match11

      public abstract boolean nextIfName4Match11(long name1)
      Checks if the next field name matches an 11-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      Returns:
      true if the field name matches the 11-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfValue4Match11

      public boolean nextIfValue4Match11(long name1)
      Checks if the next value matches an 11-character pattern. This method is used for optimized value matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      Returns:
      true if the value matches the 11-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match12

      public abstract boolean nextIfName4Match12(long name1, byte name2)
      Checks if the next field name matches a 12-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 12-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match13

      public abstract boolean nextIfName4Match13(long name1, int name2)
      Checks if the next field name matches a 13-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 13-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match14

      public boolean nextIfName4Match14(long name1, int name2)
      Checks if the next field name matches a 14-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 14-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match15

      public boolean nextIfName4Match15(long name1, int name2)
      Checks if the next field name matches a 15-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 15-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match16

      public abstract boolean nextIfName4Match16(long name1, int name2, byte name3)
      Checks if the next field name matches a 16-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 4 bytes of the name to match
      name3 - the last byte of the name to match
      Returns:
      true if the field name matches the 16-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match17

      public abstract boolean nextIfName4Match17(long name1, long name2)
      Checks if the next field name matches a 17-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 17-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match18

      public abstract boolean nextIfName4Match18(long name1, long name2)
      Checks if the next field name matches an 18-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 18-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match19

      public boolean nextIfName4Match19(long name1, long name2)
      Checks if the next field name matches a 19-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 19-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match20

      public abstract boolean nextIfName4Match20(long name1, long name2, byte name3)
      Checks if the next field name matches a 20-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the last byte of the name to match
      Returns:
      true if the field name matches the 20-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match21

      public boolean nextIfName4Match21(long name1, long name2, int name3)
      Checks if the next field name matches a 21-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 21-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match22

      public abstract boolean nextIfName4Match22(long name1, long name2, int name3)
      Checks if the next field name matches a 22-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 22-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match23

      public abstract boolean nextIfName4Match23(long name1, long name2, int name3)
      Checks if the next field name matches a 23-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 23-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match24

      public abstract boolean nextIfName4Match24(long name1, long name2, int name3, byte name4)
      Checks if the next field name matches a 24-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second to last 4 bytes of the name to match
      name4 - the last byte of the name to match
      Returns:
      true if the field name matches the 24-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match25

      public abstract boolean nextIfName4Match25(long name1, long name2, long name3)
      Checks if the next field name matches a 25-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 25-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match26

      public abstract boolean nextIfName4Match26(long name1, long name2, long name3)
      Checks if the next field name matches a 26-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 26-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match27

      public abstract boolean nextIfName4Match27(long name1, long name2, long name3)
      Checks if the next field name matches a 27-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 27-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match28

      public abstract boolean nextIfName4Match28(long name1, long name2, long name3, byte c28)
      Checks if the next field name matches a 28-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second to last 8 bytes of the name to match
      c28 - the last byte of the name to match
      Returns:
      true if the field name matches the 28-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match29

      public abstract boolean nextIfName4Match29(long name1, long name2, long name3, int name4)
      Checks if the next field name matches a 29-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second to last 8 bytes of the name to match
      name4 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 29-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match30

      public abstract boolean nextIfName4Match30(long name1, long name2, long name3, int name4)
      Checks if the next field name matches a 30-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second to last 8 bytes of the name to match
      name4 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 30-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match31

      public abstract boolean nextIfName4Match31(long name1, long name2, long name3, int name4)
      Checks if the next field name matches a 31-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second to last 8 bytes of the name to match
      name4 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 31-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match32

      public abstract boolean nextIfName4Match32(long name1, long name2, long name3, int name4, byte c32)
      Checks if the next field name matches a 32-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second to last 8 bytes of the name to match
      name4 - the second to last 4 bytes of the name to match
      c32 - the last byte of the name to match
      Returns:
      true if the field name matches the 32-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match33

      public abstract boolean nextIfName4Match33(long name1, long name2, long name3, long name4)
      Checks if the next field name matches a 33-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 33-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match34

      public abstract boolean nextIfName4Match34(long name1, long name2, long name3, long name4)
      Checks if the next field name matches a 34-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 34-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match35

      public abstract boolean nextIfName4Match35(long name1, long name2, long name3, long name4)
      Checks if the next field name matches a 35-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 35-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match36

      public abstract boolean nextIfName4Match36(long name1, long name2, long name3, long name4, byte c35)
      Checks if the next field name matches a 36-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the second to last 8 bytes of the name to match
      c35 - the last byte of the name to match
      Returns:
      true if the field name matches the 36-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match37

      public abstract boolean nextIfName4Match37(long name1, long name2, long name3, long name4, int name5)
      Checks if the next field name matches a 37-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the third to last 8 bytes of the name to match
      name5 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 37-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match38

      public abstract boolean nextIfName4Match38(long name1, long name2, long name3, long name4, int name5)
      Checks if the next field name matches a 38-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the third to last 8 bytes of the name to match
      name5 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 38-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match39

      public abstract boolean nextIfName4Match39(long name1, long name2, long name3, long name4, int name5)
      Checks if the next field name matches a 39-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the third to last 8 bytes of the name to match
      name5 - the last 4 bytes of the name to match
      Returns:
      true if the field name matches the 39-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match40

      public abstract boolean nextIfName4Match40(long name1, long name2, long name3, long name4, int name5, byte c40)
      Checks if the next field name matches a 40-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the third to last 8 bytes of the name to match
      name5 - the second to last 4 bytes of the name to match
      c40 - the last byte of the name to match
      Returns:
      true if the field name matches the 40-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match41

      public abstract boolean nextIfName4Match41(long name1, long name2, long name3, long name4, long name5)
      Checks if the next field name matches a 41-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the third middle 8 bytes of the name to match
      name5 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 41-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match42

      public abstract boolean nextIfName4Match42(long name1, long name2, long name3, long name4, long name5)
      Checks if the next field name matches a 42-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the third middle 8 bytes of the name to match
      name5 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 42-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName4Match43

      public abstract boolean nextIfName4Match43(long name1, long name2, long name3, long name4, long name5)
      Checks if the next field name matches a 43-character pattern. This method is used for optimized field name matching in JSONB format.
      Parameters:
      name1 - the first 8 bytes of the name to match
      name2 - the middle 8 bytes of the name to match
      name3 - the second middle 8 bytes of the name to match
      name4 - the third middle 8 bytes of the name to match
      name5 - the last 8 bytes of the name to match
      Returns:
      true if the field name matches the 43-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName8Match0

      public boolean nextIfName8Match0()
      Checks if the next field name matches an 8-character pattern with no additional characters. This method is used for optimized field name matching in JSONB format.
      Returns:
      true if the field name matches the 8-character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName8Match1

      public boolean nextIfName8Match1()
      Checks if the next field name matches an 8-character pattern with 1 additional character. This method is used for optimized field name matching in JSONB format.
      Returns:
      true if the field name matches the 8+1 character pattern, false otherwise
      Since:
      2.0.51
    • nextIfName8Match2

      public boolean nextIfName8Match2()
      Checks if the next field name matches an 8-character pattern with 2 additional characters. This method is used for optimized field name matching in JSONB format.
      Returns:
      true if the field name matches the 8+2 character pattern, false otherwise
      Since:
      2.0.51
    • handleResolveTasks

      public final void handleResolveTasks(Object root)
      Handles resolve tasks for circular references in the JSON data. This method processes all pending reference resolution tasks after the main parsing is complete, resolving circular references and updating the object graph.
      Parameters:
      root - The root object of the parsed JSON structure
    • getObjectReader

      public final ObjectReader getObjectReader(Type type)
      Gets an ObjectReader for the specified type from the context's provider.
      Parameters:
      type - The type for which to get an ObjectReader
      Returns:
      An ObjectReader for the specified type
    • isSupportSmartMatch

      public final boolean isSupportSmartMatch()
      Checks if the SmartMatch feature is enabled in the context.
      Returns:
      true if SmartMatch is enabled, false otherwise
    • isInitStringFieldAsEmpty

      public final boolean isInitStringFieldAsEmpty()
      Checks if the InitStringFieldAsEmpty feature is enabled in the context.
      Returns:
      true if InitStringFieldAsEmpty is enabled, false otherwise
    • isSupportSmartMatch

      public final boolean isSupportSmartMatch(long features)
      Checks if the SmartMatch feature is enabled, considering additional features.
      Parameters:
      features - Additional features to consider
      Returns:
      true if SmartMatch is enabled with the given features, false otherwise
    • isSupportBeanArray

      public final boolean isSupportBeanArray()
      Checks if the SupportArrayToBean feature is enabled in the context.
      Returns:
      true if SupportArrayToBean is enabled, false otherwise
    • isSupportBeanArray

      public final boolean isSupportBeanArray(long features)
      Checks if the SupportArrayToBean feature is enabled, considering additional features.
      Parameters:
      features - Additional features to consider
      Returns:
      true if SupportArrayToBean is enabled with the given features, false otherwise
    • isSupportAutoType

      public final boolean isSupportAutoType(long features)
      Checks if the SupportAutoType feature is enabled, considering additional features.
      Parameters:
      features - Additional features to consider
      Returns:
      true if SupportAutoType is enabled with the given features, false otherwise
    • isSupportAutoTypeOrHandler

      public final boolean isSupportAutoTypeOrHandler(long features)
      Checks if the SupportAutoType feature or handler is enabled, considering additional features.
      Parameters:
      features - Additional features to consider
      Returns:
      true if SupportAutoType or a handler is enabled with the given features, false otherwise
    • isJSONB

      public final boolean isJSONB()
      Checks if this reader is using JSONB binary format.
      Returns:
      true if using JSONB format, false otherwise
    • isIgnoreNoneSerializable

      public final boolean isIgnoreNoneSerializable()
      Checks if the IgnoreNoneSerializable feature is enabled in the context.
      Returns:
      true if IgnoreNoneSerializable is enabled, false otherwise
    • hasAutoTypeBeforeHandler

      public boolean hasAutoTypeBeforeHandler()
      Checks if there is an auto-type before handler configured in the context.
      Returns:
      true if there is an auto-type before handler, false otherwise
    • checkAutoType

      public ObjectReader checkAutoType(Class expectClass, long expectClassHash, long features)
      Checks the auto type for the specified class and hash, considering additional features.
      Parameters:
      expectClass - The expected class
      expectClassHash - The expected class hash
      features - Additional features to consider
      Returns:
      An ObjectReader for the auto-detected type, or null if not found
    • nextIfObjectStart

      public abstract boolean nextIfObjectStart()
      Checks if the current character is the start of a JSON object ('{') and advances the reader if it is.
      Returns:
      true if the current character is '{', false otherwise
    • nextIfNullOrEmptyString

      public abstract boolean nextIfNullOrEmptyString()
      Checks if the current value is a null or empty string and advances the reader if it is.
      Returns:
      true if the current value is null or an empty string, false otherwise
    • nextIfObjectEnd

      public abstract boolean nextIfObjectEnd()
      Checks if the current character is the end of a JSON object ('}') and advances the reader if it is.
      Returns:
      true if the current character is '}', false otherwise
    • startArray

      public int startArray()
      Starts reading a JSON array, advancing the reader to the first element.
      Returns:
      The maximum integer value as a placeholder
      Throws:
      JSONException - if the current character is not the start of an array ('[')
    • isReference

      public abstract boolean isReference()
      Checks if the current value represents a reference.
      Returns:
      true if the current value represents a reference, false otherwise
    • readReference

      public abstract String readReference()
      Reads a reference value from JSON data.
      Returns:
      The reference value as a string
    • readReference

      public final boolean readReference(List list, int i)
      Reads a reference value from JSON data and adds it to the specified list at the given index.
      Parameters:
      list - The list to which the reference should be added
      i - The index at which to add the reference in the list
      Returns:
      true if a reference was read and added, false otherwise
    • readReference

      public boolean readReference(Collection list, int i)
      Reads a reference value from JSON data and adds it to the specified collection at the given index.
      Parameters:
      list - The collection to which the reference should be added
      i - The index at which to add the reference in the collection
      Returns:
      true if a reference was read and added, false otherwise
    • addResolveTask

      public final void addResolveTask(FieldReader fieldReader, Object object, JSONPath path)
    • addResolveTask

      public final void addResolveTask(Map object, Object key, JSONPath reference)
    • addResolveTask

      public final void addResolveTask(Collection object, int i, JSONPath reference)
    • addResolveTask

      public final void addResolveTask(Object[] object, int i, JSONPath reference)
    • isArray

      public boolean isArray()
      Checks if the current character represents the start of a JSON array.
      Returns:
      true if the current character is '[', false otherwise
    • isObject

      public boolean isObject()
      Checks if the current character represents the start of a JSON object.
      Returns:
      true if the current character is '{', false otherwise
    • isNumber

      public boolean isNumber()
      Checks if the current character represents the start of a JSON number.
      Returns:
      true if the current character is a digit or sign, false otherwise
    • isString

      public boolean isString()
      Checks if the current character represents the start of a JSON string.
      Returns:
      true if the current character is a quote, false otherwise
    • endArray

      public void endArray()
      Advances the reader to the end of the current JSON array.
    • nextIfMatch

      public abstract boolean nextIfMatch(char ch)
      Checks if the current character matches the specified character and advances the reader if it does.
      Parameters:
      ch - The character to match
      Returns:
      true if the current character matches the specified character, false otherwise
    • nextIfComma

      public abstract boolean nextIfComma()
      Checks if the current character is a comma (',') and advances the reader if it is.
      Returns:
      true if the current character is a comma, false otherwise
    • nextIfArrayStart

      public abstract boolean nextIfArrayStart()
      Checks if the current character is the start of a JSON array ('[') and advances the reader if it is.
      Returns:
      true if the current character is '[', false otherwise
    • nextIfArrayEnd

      public abstract boolean nextIfArrayEnd()
      Checks if the current character is the end of a JSON array (']') and advances the reader if it is.
      Returns:
      true if the current character is ']', false otherwise
    • nextIfSet

      public abstract boolean nextIfSet()
      Checks if the current value represents a Set and advances the reader if it is. This method is used to detect Set-type collections during JSON parsing.
      Returns:
      true if the current value represents a Set, false otherwise
      Since:
      2.0.51
    • nextIfInfinity

      public abstract boolean nextIfInfinity()
      Checks if the current value represents infinity and advances the reader if it is. This method is used to detect infinity values during JSON parsing.
      Returns:
      true if the current value represents infinity, false otherwise
      Since:
      2.0.51
    • readPattern

      public abstract String readPattern()
      Reads a pattern string from the JSON data. This method is used to read regular expression patterns or other pattern strings.
      Returns:
      The pattern string read from the JSON data
      Since:
      2.0.51
    • getOffset

      public final int getOffset()
    • next

      public abstract void next()
      Advances the reader to the next character in the JSON data.
    • nextWithoutComment

      public void nextWithoutComment()
      Advances the reader to the next character in the JSON data, skipping comment processing.
    • readValueHashCode

      public abstract long readValueHashCode()
      Reads the hash code of the current JSON value.
      Returns:
      The hash code of the current value
    • readTypeHashCode

      public long readTypeHashCode()
      Reads the hash code of the current type in the JSON data.
      Returns:
      The hash code of the current type
    • readFieldNameHashCode

      public abstract long readFieldNameHashCode()
      Reads the hash code of the current field name in a JSON object.
      Returns:
      The hash code of the current field name
    • getNameHashCodeLCase

      public abstract long getNameHashCodeLCase()
      Reads the hash code of the current field name in lowercase.
      Returns:
      The hash code of the current field name in lowercase
    • readFieldName

      public abstract String readFieldName()
      Reads the current field name in a JSON object.
      Returns:
      The current field name
    • getFieldName

      public abstract String getFieldName()
      Gets the current field name in a JSON object.
      Returns:
      The current field name
    • setTypeRedirect

      public final void setTypeRedirect(boolean typeRedirect)
      Sets the type redirect flag for this reader.
      Parameters:
      typeRedirect - true to enable type redirection, false to disable
    • isTypeRedirect

      public final boolean isTypeRedirect()
      Checks if type redirection is enabled for this reader.
      Returns:
      true if type redirection is enabled, false otherwise
    • readFieldNameHashCodeUnquote

      public abstract long readFieldNameHashCodeUnquote()
      Reads the hash code of the current field name in a JSON object without requiring quotes.
      Returns:
      The hash code of the current field name
    • readFieldNameUnquote

      public final String readFieldNameUnquote()
      Reads the current field name in a JSON object without requiring quotes.
      Returns:
      The current field name
      Throws:
      JSONException - if the field name is null or empty
    • skipName

      public abstract boolean skipName()
      Skips the current field name in a JSON object.
      Returns:
      true if the field name was successfully skipped, false otherwise
    • skipValue

      public abstract void skipValue()
      Skips the current JSON value, advancing the reader to the next value or end of the current structure.
    • isBinary

      public boolean isBinary()
      Checks if the current value represents binary data.
      Returns:
      true if the current value is binary data, false otherwise
    • readHex

      public abstract byte[] readHex()
      Reads a hexadecimal string from JSON data and converts it to a byte array.
      Returns:
      The byte array representation of the hexadecimal string
    • readBinary

      public byte[] readBinary()
      Reads binary data from JSON data.
      Returns:
      The byte array representation of the binary data
      Throws:
      JSONException - if there is an error parsing the binary data
    • readInt32Value

      public abstract int readInt32Value()
      Reads a 32-bit integer value from JSON data.
      Returns:
      The 32-bit integer value
    • readInt32ValueArray

      public int[] readInt32ValueArray()
      Reads an array of 32-bit integer values from JSON data.
      Returns:
      The array of 32-bit integer values
      Throws:
      JSONException - if there is an error parsing the JSON
    • nextIfMatch

      public boolean nextIfMatch(byte type)
      Checks if the next value matches the specified type and advances the reader if it does.
      Parameters:
      type - The type to match
      Returns:
      true if the next value matches the specified type, false otherwise
      Throws:
      JSONException - as this operation is not supported
    • nextIfMatchTypedAny

      public boolean nextIfMatchTypedAny()
      Checks if the next value matches any type and advances the reader if it does.
      Returns:
      true if the next value matches any type, false otherwise
      Throws:
      JSONException - as this operation is not supported
    • nextIfMatchIdent

      public abstract boolean nextIfMatchIdent(char c0, char c1)
    • nextIfMatchIdent

      public abstract boolean nextIfMatchIdent(char c0, char c1, char c2)
    • nextIfMatchIdent

      public abstract boolean nextIfMatchIdent(char c0, char c1, char c2, char c3)
    • nextIfMatchIdent

      public abstract boolean nextIfMatchIdent(char c0, char c1, char c2, char c3, char c4)
    • nextIfMatchIdent

      public abstract boolean nextIfMatchIdent(char c0, char c1, char c2, char c3, char c4, char c5)
    • readInt8

      public final Byte readInt8()
      Reads a Byte object from JSON data.
      Returns:
      The Byte object, or null if the value is null in JSON
    • readInt8Value

      public byte readInt8Value()
      Reads a byte value from JSON data.
      Returns:
      The byte value
    • readInt16

      public final Short readInt16()
      Reads a Short object from JSON data.
      Returns:
      The Short object, or null if the value is null in JSON
    • readInt16Value

      public short readInt16Value()
      Reads a short value from JSON data.
      Returns:
      The short value
    • readInt32

      public abstract Integer readInt32()
      Reads an Integer object from JSON data.
      Returns:
      The Integer object, or null if the value is null in JSON
    • readInt32ValueOverflow

      protected final int readInt32ValueOverflow()
      Reads a 32-bit integer value from JSON data, handling overflow conditions.
      Returns:
      The 32-bit integer value
    • readInt64ValueOverflow

      protected final long readInt64ValueOverflow()
      Reads a 64-bit long value from JSON data, handling overflow conditions.
      Returns:
      The 64-bit long value
    • getInt32Value

      public final int getInt32Value()
    • getInt64Value

      public final long getInt64Value()
    • getDoubleValue

      public final double getDoubleValue()
    • getFloatValue

      public final float getFloatValue()
    • readInt64ValueArray

      public long[] readInt64ValueArray()
      Reads an array of 64-bit long values from JSON data.
      Returns:
      The array of 64-bit long values
      Throws:
      JSONException - if there is an error parsing the JSON
    • readInt64Value

      public abstract long readInt64Value()
      Reads a 64-bit long value from JSON data.
      Returns:
      The 64-bit long value
    • readInt64

      public abstract Long readInt64()
      Reads a Long object from JSON data.
      Returns:
      The Long object, or null if the value is null in JSON
    • readFloatValue

      public abstract float readFloatValue()
      Reads a float value from JSON data.
      Returns:
      The float value
    • readFloat

      public Float readFloat()
      Reads a Float object from JSON data.
      Returns:
      The Float object, or null if the value is null in JSON
    • readDoubleValue

      public abstract double readDoubleValue()
      Reads a double value from JSON data.
      Returns:
      The double value
    • readDouble

      public final Double readDouble()
      Reads a Double object from JSON data.
      Returns:
      The Double object, or null if the value is null in JSON
    • readNumber

      public Number readNumber()
      Reads a Number value from JSON data.
      Returns:
      The Number value
    • readBigInteger

      public BigInteger readBigInteger()
      Reads a BigInteger value from JSON data.
      Returns:
      The BigInteger value
    • readBigDecimal

      public abstract BigDecimal readBigDecimal()
      Reads a BigDecimal value from JSON data.
      Returns:
      The BigDecimal value
    • readUUID

      public abstract UUID readUUID()
      Reads a UUID value from JSON data.
      Returns:
      The UUID value
    • readLocalDate

      public LocalDate readLocalDate()
      Reads a LocalDate value from JSON data.
      Returns:
      The LocalDate value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the date
    • readLocalDateTime

      public LocalDateTime readLocalDateTime()
      Reads a LocalDateTime value from JSON data.
      Returns:
      The LocalDateTime value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the date/time
    • readOffsetDateTime

      public abstract OffsetDateTime readOffsetDateTime()
    • readZonedDateTime

      public ZonedDateTime readZonedDateTime()
      Reads a ZonedDateTime value from JSON data.
      Returns:
      The ZonedDateTime value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the date/time
    • readOffsetTime

      public abstract OffsetTime readOffsetTime()
    • readCalendar

      public Calendar readCalendar()
      Reads a Calendar value from JSON data.
      Returns:
      The Calendar value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the date
    • readDate

      public Date readDate()
      Reads a Date value from JSON data.
      Returns:
      The Date value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the date
    • readLocalTime

      public LocalTime readLocalTime()
      Reads a LocalTime value from JSON data.
      Returns:
      The LocalTime value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the time
    • getStringLength

      protected abstract int getStringLength()
      Gets the length of the current string value in the JSON data.
      Returns:
      The length of the current string value
    • isDate

      public boolean isDate()
      Checks if the current value represents a date.
      Returns:
      true if the current value represents a date, false otherwise
    • readInstant

      public Instant readInstant()
      Reads an Instant value from JSON data.
      Returns:
      The Instant value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the instant
    • readMillisFromString

      public final long readMillisFromString()
      Reads milliseconds from a string value in JSON data.
      Returns:
      The milliseconds value
      Throws:
      JSONException - if there is an error parsing the string
    • readLocalDateTime12

      protected abstract LocalDateTime readLocalDateTime12()
    • readLocalDateTime14

      protected abstract LocalDateTime readLocalDateTime14()
    • readLocalDateTime16

      protected abstract LocalDateTime readLocalDateTime16()
    • readLocalDateTime17

      protected abstract LocalDateTime readLocalDateTime17()
    • readLocalDateTime18

      protected abstract LocalDateTime readLocalDateTime18()
    • readLocalDateTime19

      protected abstract LocalDateTime readLocalDateTime19()
    • readLocalDateTime20

      protected abstract LocalDateTime readLocalDateTime20()
    • readMillis19

      public abstract long readMillis19()
      Reads milliseconds from a 19-character date string in JSON data.
      Returns:
      The milliseconds value
    • readLocalDateTimeX

      protected abstract LocalDateTime readLocalDateTimeX(int len)
    • readLocalTime5

      protected abstract LocalTime readLocalTime5()
    • readLocalTime6

      protected abstract LocalTime readLocalTime6()
    • readLocalTime7

      protected abstract LocalTime readLocalTime7()
    • readLocalTime8

      protected abstract LocalTime readLocalTime8()
    • readLocalTime9

      protected abstract LocalTime readLocalTime9()
    • readLocalTime10

      protected abstract LocalTime readLocalTime10()
    • readLocalTime11

      protected abstract LocalTime readLocalTime11()
    • readLocalTime12

      protected abstract LocalTime readLocalTime12()
    • readLocalTime15

      protected abstract LocalTime readLocalTime15()
    • readLocalTime18

      protected abstract LocalTime readLocalTime18()
    • readLocalDate8

      protected abstract LocalDate readLocalDate8()
    • readLocalDate9

      protected abstract LocalDate readLocalDate9()
    • readLocalDate10

      protected abstract LocalDate readLocalDate10()
    • readLocalDate11

      protected abstract LocalDate readLocalDate11()
    • readZonedDateTimeX

      protected abstract ZonedDateTime readZonedDateTimeX(int len)
    • readNumber

      public void readNumber(ValueConsumer consumer, boolean quoted)
      Reads a number value from JSON data and passes it to a consumer.
      Parameters:
      consumer - The consumer to accept the number value
      quoted - Whether the number should be quoted in the output
    • readString

      public void readString(ValueConsumer consumer, boolean quoted)
      Reads a string value from JSON data and passes it to a consumer.
      Parameters:
      consumer - The consumer to accept the string value
      quoted - Whether the string should be quoted in the output
    • readString

      public abstract String readString()
      Reads a string value from JSON data.
      Returns:
      The string value
    • readNumber0

      protected abstract void readNumber0()
      Reads a number value from JSON data and stores it in internal fields. This is a low-level method used by other number reading methods.
    • readBase64

      public byte[] readBase64()
      Reads a Base64 encoded string from JSON data and decodes it to bytes.
      Returns:
      The decoded byte array
    • readStringArray

      public String[] readStringArray()
      Reads a JSON array of strings and returns it as a String array.
      Returns:
      The String array, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the JSON
    • readCharValue

      public char readCharValue()
      Reads a character value from JSON data.
      Returns:
      The character value
    • readCharacter

      public Character readCharacter()
      Reads a Character object from JSON data.
      Returns:
      The Character object, or null if the value is null in JSON
    • readNull

      public abstract void readNull()
      Reads a null value from JSON data and advances the reader.
    • readNaN

      protected double readNaN()
    • readIfNull

      public abstract boolean readIfNull()
      Checks if the current JSON value is null and advances the reader if it is.
      Returns:
      true if the current value is null, false otherwise
    • getString

      public abstract String getString()
      Gets the current string value from the JSON data.
      Returns:
      The current string value
    • wasNull

      public boolean wasNull()
    • read

      public <T> T read(Type type)
    • read

      public final void read(List list)
    • read

      public final void read(Collection list)
    • readObject

      public final void readObject(Object object, JSONReader.Feature... features)
    • readObject

      public final void readObject(Object object, long features)
    • read

      public void read(Map object, ObjectReader itemReader, long features)
      Reads JSON data into a Map using a specified ObjectReader for the values.
      Parameters:
      object - The Map to populate with data
      itemReader - The ObjectReader to use for reading values
      features - Reader features to apply during reading
      Since:
      2.0.35
    • read

      public void read(Map object, long features)
      Reads JSON data into a Map with specified features.
      Parameters:
      object - The Map to populate with data
      features - Reader features to apply during reading
    • read

      public final void read(Map object, Type keyType, Type valueType, long features)
      Reads JSON data into a Map with specified key and value types.
      Parameters:
      object - The Map to populate with data
      keyType - The type of keys in the map
      valueType - The type of values in the map
      features - Reader features to apply during reading
    • read

      public <T> T read(Class<T> type)
    • readObject

      public Map<String,Object> readObject()
      Reads JSON data and returns it as a Map.
      Returns:
      A Map representation of the JSON data
      Throws:
      JSONException - if there is an error parsing the JSON
    • skipComment

      public abstract void skipComment()
      Skips a comment in the JSON data, advancing the reader to the end of the comment.
    • readBool

      public Boolean readBool()
      Reads a boolean value from JSON data.
      Returns:
      The boolean value, or null if the value is null in JSON
      Throws:
      JSONException - if there is an error parsing the JSON
    • readBoolValue

      public abstract boolean readBoolValue()
      Reads a boolean value from JSON data.
      Returns:
      The boolean value
    • readAny

      public Object readAny()
      Reads any JSON value and returns it as an Object.
      Returns:
      The JSON value as an Object
    • readArray

      public List readArray(Type itemType)
      Reads a JSON array with elements of a specified type.
      Parameters:
      itemType - The type of elements in the array
      Returns:
      A List containing the array elements
    • readList

      public List readList(Type[] types)
      Reads a JSON array with elements of specified types.
      Parameters:
      types - The types of elements in the array
      Returns:
      A List containing the array elements
    • readArray

      public final Object[] readArray(Type[] types)
      Reads a JSON array with elements of specified types into an Object array.
      Parameters:
      types - The types of elements in the array
      Returns:
      An Object array containing the array elements
    • readArray

      public final void readArray(List list, Type itemType)
    • readArray

      public void readArray(Collection list, Type itemType)
    • readJSONArray

      public final JSONArray readJSONArray()
      Reads a JSON array and returns it as a JSONArray.
      Returns:
      A JSONArray representation of the JSON array
    • readJSONObject

      public final JSONObject readJSONObject()
      Reads a JSON object and returns it as a JSONObject.
      Returns:
      A JSONObject representation of the JSON object
    • readArray

      public List readArray()
      Reads a JSON array and returns it as a List.
      Returns:
      A List representation of the JSON array
    • getBigInteger

      public final BigInteger getBigInteger()
    • getBigDecimal

      public final BigDecimal getBigDecimal()
    • getNumber

      public final Number getNumber()
    • close

      public abstract void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • toInt32

      protected final int toInt32(String val)
    • toInt64

      protected final long toInt64(String val)
    • toLong

      protected final long toLong(Map map)
    • toInt

      protected final int toInt(List list)
    • toNumber

      protected final Number toNumber(Map map)
    • decimal

      protected final BigDecimal decimal(JSONObject object)
    • toNumber

      protected final Number toNumber(List list)
    • toString

      protected final String toString(List array)
    • toString

      protected final String toString(Map object)
    • of

      public static JSONReader of(byte[] utf8Bytes)
      Creates a JSONReader from a byte array containing UTF-8 encoded JSON.
      Parameters:
      utf8Bytes - The byte array containing UTF-8 encoded JSON
      Returns:
      A JSONReader instance
    • of

      @Deprecated public static JSONReader of(JSONReader.Context context, byte[] utf8Bytes)
      Deprecated.
    • of

      public static JSONReader of(byte[] utf8Bytes, JSONReader.Context context)
    • of

      public static JSONReader of(char[] chars)
      Creates a JSONReader from a character array containing JSON data.
      Parameters:
      chars - The character array containing JSON data
      Returns:
      A JSONReader instance
    • of

      @Deprecated public static JSONReader of(JSONReader.Context context, char[] chars)
      Deprecated.
    • of

      public static JSONReader of(char[] chars, JSONReader.Context context)
    • ofJSONB

      public static JSONReader ofJSONB(byte[] jsonbBytes)
      Creates a JSONReader from a byte array containing JSONB (binary JSON) data.
      Parameters:
      jsonbBytes - The byte array containing JSONB data
      Returns:
      A JSONReader instance for JSONB data
    • ofJSONB

      @Deprecated public static JSONReader ofJSONB(JSONReader.Context context, byte[] jsonbBytes)
      Deprecated.
    • ofJSONB

      public static JSONReader ofJSONB(byte[] jsonbBytes, JSONReader.Context context)
    • ofJSONB

      public static JSONReader ofJSONB(InputStream in, JSONReader.Context context)
    • ofJSONB

      public static JSONReader ofJSONB(byte[] jsonbBytes, JSONReader.Feature... features)
    • ofJSONB

      public static JSONReader ofJSONB(byte[] bytes, int offset, int length)
    • ofJSONB

      public static JSONReader ofJSONB(byte[] bytes, int offset, int length, JSONReader.Context context)
    • ofJSONB

      public static JSONReader ofJSONB(byte[] bytes, int offset, int length, SymbolTable symbolTable)
    • of

      public static JSONReader of(byte[] bytes, int offset, int length, Charset charset)
    • of

      public static JSONReader of(byte[] bytes, int offset, int length, Charset charset, JSONReader.Context context)
    • of

      public static JSONReader of(byte[] bytes, int offset, int length)
    • of

      public static JSONReader of(byte[] bytes, int offset, int length, JSONReader.Context context)
    • of

      public static JSONReader of(char[] chars, int offset, int length)
    • of

      public static JSONReader of(char[] chars, int offset, int length, JSONReader.Context context)
    • of

      public static JSONReader of(URL url, JSONReader.Context context) throws IOException
      Throws:
      IOException
    • of

      public static JSONReader of(InputStream is, Charset charset)
      Creates a JSONReader from an InputStream containing JSON data.
      Parameters:
      is - The InputStream containing JSON data
      charset - The character encoding of the JSON data
      Returns:
      A JSONReader instance
    • of

      public static JSONReader of(InputStream is, Charset charset, JSONReader.Context context)
    • of

      public static JSONReader of(Reader is)
      Creates a JSONReader from a Reader containing JSON data.
      Parameters:
      is - The Reader containing JSON data
      Returns:
      A JSONReader instance
    • of

      public static JSONReader of(Reader is, JSONReader.Context context)
    • of

      public static JSONReader of(ByteBuffer buffer, Charset charset)
    • of

      public static JSONReader of(ByteBuffer buffer, Charset charset, JSONReader.Context context)
    • of

      @Deprecated public static JSONReader of(JSONReader.Context context, String str)
      Deprecated.
    • of

      public static JSONReader of(String str)
      Creates a JSONReader from a String containing JSON data.
      Parameters:
      str - The String containing JSON data
      Returns:
      A JSONReader instance
    • of

      public static JSONReader of(String str, JSONReader.Context context)
    • of

      public static JSONReader of(String str, int offset, int length)
      Creates a JSONReader from a substring of a String containing JSON data.
      Parameters:
      str - The String containing JSON data
      offset - The starting position of the substring
      length - The length of the substring
      Returns:
      A JSONReader instance
    • of

      public static JSONReader of(String str, int offset, int length, JSONReader.Context context)
    • autoTypeFilter

      public static JSONReader.AutoTypeBeforeHandler autoTypeFilter(String... names)
    • autoTypeFilter

      public static JSONReader.AutoTypeBeforeHandler autoTypeFilter(boolean includeBasic, String... names)
    • autoTypeFilter

      public static JSONReader.AutoTypeBeforeHandler autoTypeFilter(Class... types)
    • autoTypeFilter

      public static JSONReader.AutoTypeBeforeHandler autoTypeFilter(boolean includeBasic, Class... types)
    • mark

      public JSONReader.SavePoint mark()
    • reset

      public void reset(JSONReader.SavePoint savePoint)
    • info

      public final String info()
    • info

      public String info(String message)
    • getObjectReaderAutoType

      public ObjectReader getObjectReaderAutoType(long typeHash, Class expectClass, long features)
      Gets an ObjectReader for the specified type hash, expected class, and features. This method handles auto-type detection and applies any configured auto-type before handlers.
      Parameters:
      typeHash - The hash code of the type
      expectClass - The expected class
      features - Additional features to consider
      Returns:
      An ObjectReader for the specified type, or null if not found
    • readStringNotMatch

      protected final String readStringNotMatch()
    • stringValue

      protected static String stringValue(String str, long features)