Package com.jsoniter

Class JsonIterator

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class JsonIterator
    extends java.lang.Object
    implements java.io.Closeable
    • Field Detail

      • configCache

        public Config configCache
      • isStreamingEnabled

        private static boolean isStreamingEnabled
      • valueTypes

        static final ValueType[] valueTypes
      • in

        java.io.InputStream in
      • buf

        byte[] buf
      • head

        int head
      • tail

        int tail
      • skipStartedAt

        int skipStartedAt
      • tempObjects

        java.util.Map<java.lang.String,​java.lang.Object> tempObjects
      • reusableSlice

        final Slice reusableSlice
      • reusableChars

        char[] reusableChars
      • existingObject

        java.lang.Object existingObject
    • Constructor Detail

      • JsonIterator

        private JsonIterator​(java.io.InputStream in,
                             byte[] buf,
                             int head,
                             int tail)
      • JsonIterator

        public JsonIterator()
    • Method Detail

      • parse

        public static JsonIterator parse​(java.io.InputStream in,
                                         int bufSize)
      • parse

        public static JsonIterator parse​(byte[] buf,
                                         int head,
                                         int tail)
      • parse

        public static JsonIterator parse​(java.lang.String str)
      • reset

        public final void reset​(byte[] buf)
      • reset

        public final void reset​(byte[] buf,
                                int head,
                                int tail)
      • reset

        public final void reset​(Slice value)
      • reset

        public final void reset​(java.io.InputStream in)
      • close

        public final void close()
                         throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • unreadByte

        final void unreadByte()
      • reportError

        public final JsonException reportError​(java.lang.String op,
                                               java.lang.String msg)
      • currentBuffer

        public final java.lang.String currentBuffer()
      • readNull

        public final boolean readNull()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • readBoolean

        public final boolean readBoolean()
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • readShort

        public final short readShort()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • readInt

        public final int readInt()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readLong

        public final long readLong()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • readArray

        public final boolean readArray()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readNumberAsString

        public java.lang.String readNumberAsString()
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • readArrayCB

        public final boolean readArrayCB​(JsonIterator.ReadArrayCallback callback,
                                         java.lang.Object attachment)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • readString

        public final java.lang.String readString()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readStringAsSlice

        public final Slice readStringAsSlice()
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readObject

        public final java.lang.String readObject()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readObjectCB

        public final void readObjectCB​(JsonIterator.ReadObjectCallback cb,
                                       java.lang.Object attachment)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readFloat

        public final float readFloat()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • readDouble

        public final double readDouble()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readBigDecimal

        public final java.math.BigDecimal readBigDecimal()
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • readBigInteger

        public final java.math.BigInteger readBigInteger()
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • readAny

        public final Any readAny()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public final java.lang.Object read()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public final <T> T read​(T existingObject)
                         throws java.io.IOException
        try to bind to existing object, returned object might not the same instance
        Type Parameters:
        T - object type
        Parameters:
        existingObject - the object instance to reuse
        Returns:
        data binding result, might not be the same object
        Throws:
        java.io.IOException - if I/O went wrong
      • currentConfig

        private Config currentConfig()
      • read

        public final <T> T read​(TypeLiteral<T> typeLiteral,
                                T existingObject)
                         throws java.io.IOException
        try to bind to existing object, returned object might not the same instance
        Type Parameters:
        T - object type
        Parameters:
        typeLiteral - the type object
        existingObject - the object instance to reuse
        Returns:
        data binding result, might not be the same object
        Throws:
        java.io.IOException - if I/O went wrong
      • read

        public final <T> T read​(java.lang.Class<T> clazz)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public final <T> T read​(TypeLiteral<T> typeLiteral)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public final java.lang.Object read​(java.lang.reflect.Type type)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • whatIsNext

        public ValueType whatIsNext()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • skip

        public void skip()
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • deserialize

        public static final <T> T deserialize​(Config config,
                                              java.lang.String input,
                                              java.lang.Class<T> clazz)
      • deserialize

        public static final <T> T deserialize​(java.lang.String input,
                                              java.lang.Class<T> clazz)
      • deserialize

        public static final <T> T deserialize​(Config config,
                                              java.lang.String input,
                                              TypeLiteral<T> typeLiteral)
      • deserialize

        public static final <T> T deserialize​(java.lang.String input,
                                              TypeLiteral<T> typeLiteral)
      • deserialize

        public static final <T> T deserialize​(Config config,
                                              byte[] input,
                                              java.lang.Class<T> clazz)
      • deserialize

        public static final <T> T deserialize​(byte[] input,
                                              java.lang.Class<T> clazz)
      • deserialize

        public static final <T> T deserialize​(Config config,
                                              byte[] input,
                                              TypeLiteral<T> typeLiteral)
      • deserialize

        public static final <T> T deserialize​(byte[] input,
                                              TypeLiteral<T> typeLiteral)
      • deserialize

        public static final Any deserialize​(Config config,
                                            java.lang.String input)
      • deserialize

        public static final Any deserialize​(java.lang.String input)
      • deserialize

        public static final Any deserialize​(Config config,
                                            byte[] input)
      • deserialize

        public static final Any deserialize​(byte[] input)
      • findLastNotSpacePos

        private static int findLastNotSpacePos​(byte[] input)
      • setMode

        public static void setMode​(DecodingMode mode)
      • enableStreamingSupport

        public static void enableStreamingSupport()