Class NonBlockingJsonParser

    • Field Detail

      • _icLatin1

        protected static final int[] _icLatin1
      • _origBufferLen

        protected int _origBufferLen
        In addition to current buffer pointer, and end pointer, we will also need to know number of bytes originally contained. This is needed to correctly update location information when the block has been completed.
    • Method Detail

      • getNonBlockingInputFeeder

        public ByteArrayFeeder getNonBlockingInputFeeder()
        Description copied from class: JsonParser
        Method that will either return a feeder instance (if parser uses non-blocking, aka asynchronous access); or null for parsers that use blocking I/O.
        Overrides:
        getNonBlockingInputFeeder in class JsonParser
        Returns:
        Input feeder to use with non-blocking (async) parsing
      • needMoreInput

        public final boolean needMoreInput()
        Description copied from interface: NonBlockingInputFeeder
        Method called to check whether it is ok to feed more data: parser returns true if it has no more content to parse (and it is ok to feed more); otherwise false (and no data should yet be fed).
        Specified by:
        needMoreInput in interface NonBlockingInputFeeder
        Returns:
        True if more input is needed (and can be fed); false if there is still some input to decode
      • feedInput

        public void feedInput​(byte[] buf,
                              int start,
                              int end)
                       throws java.io.IOException
        Description copied from interface: ByteArrayFeeder
        Method that can be called to feed more data, if (and only if) NonBlockingInputFeeder.needMoreInput() returns true.
        Specified by:
        feedInput in interface ByteArrayFeeder
        Parameters:
        buf - Byte array that contains data to feed: caller must ensure data remains stable until it is fully processed (which is true when NonBlockingInputFeeder.needMoreInput() returns true)
        start - Offset within array where input data to process starts
        end - Offset after last byte contained in the input array
        Throws:
        java.io.IOException - if the state is such that this method should not be called (has not yet consumed existing input data, or has been marked as closed)
      • releaseBuffered

        public int releaseBuffered​(java.io.OutputStream out)
                            throws java.io.IOException
        Description copied from class: JsonParser
        Method that can be called to push back any content that has been read but not consumed by the parser. This is usually done after reading all content of interest using parser. Content is released by writing it to given stream if possible; if underlying input is byte-based it can released, if not (char-based) it can not.
        Specified by:
        releaseBuffered in class NonBlockingJsonParserBase
        Parameters:
        out - OutputStream to which buffered, undecoded content is written to
        Returns:
        -1 if the underlying content source is not byte based (that is, input can not be sent to OutputStream; otherwise number of bytes released (0 if there was nothing to release)
        Throws:
        java.io.IOException - if write to stream threw exception
      • _decodeEscaped

        protected char _decodeEscaped()
                               throws java.io.IOException
        Description copied from class: ParserBase
        Method that sub-classes must implement to support escaped sequences in base64-encoded sections. Sub-classes that do not need base64 support can leave this as is
        Overrides:
        _decodeEscaped in class ParserBase
        Throws:
        java.io.IOException
      • nextToken

        public JsonToken nextToken()
                            throws java.io.IOException
        Description copied from class: JsonParser
        Main iteration method, which will advance stream enough to determine type of the next token, if any. If none remaining (stream has no content other than possible white space before ending), null will be returned.
        Specified by:
        nextToken in class ParserMinimalBase
        Returns:
        Next token from the stream, if any found, or null to indicate end-of-input
        Throws:
        java.io.IOException - for low-level read issues, or JsonParseException for decoding problems
      • _finishToken

        protected final JsonToken _finishToken()
                                        throws java.io.IOException
        Method called when decoding of a token has been started, but not yet completed due to missing input; method is to continue decoding due to at least one more byte being made available to decode.
        Throws:
        java.io.IOException
      • _finishTokenWithEOF

        protected final JsonToken _finishTokenWithEOF()
                                               throws java.io.IOException
        Method similar to _finishToken(), but called when no more input is available, and end-of-input has been detected. This is usually problem case, but not always: root-level values may be properly terminated by this, and similarly trailing white-space may have been skipped.
        Throws:
        java.io.IOException
      • _startUnexpectedValue

        protected JsonToken _startUnexpectedValue​(boolean leadingComma,
                                                  int ch)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • _startFalseToken

        protected JsonToken _startFalseToken()
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • _startTrueToken

        protected JsonToken _startTrueToken()
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _startNullToken

        protected JsonToken _startNullToken()
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishKeywordToken

        protected JsonToken _finishKeywordToken​(java.lang.String expToken,
                                                int matched,
                                                JsonToken result)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishKeywordTokenWithEOF

        protected JsonToken _finishKeywordTokenWithEOF​(java.lang.String expToken,
                                                       int matched,
                                                       JsonToken result)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishNonStdToken

        protected JsonToken _finishNonStdToken​(int type,
                                               int matched)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishNonStdTokenWithEOF

        protected JsonToken _finishNonStdTokenWithEOF​(int type,
                                                      int matched)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishErrorToken

        protected JsonToken _finishErrorToken()
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishErrorTokenWithEOF

        protected JsonToken _finishErrorTokenWithEOF()
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • _reportErrorToken

        protected JsonToken _reportErrorToken​(java.lang.String actualToken)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • _startFloatThatStartsWithPeriod

        protected JsonToken _startFloatThatStartsWithPeriod()
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _startPositiveNumber

        protected JsonToken _startPositiveNumber​(int ch)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • _startNegativeNumber

        protected JsonToken _startNegativeNumber()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • _startNumberLeadingZero

        protected JsonToken _startNumberLeadingZero()
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishNumberMinus

        protected JsonToken _finishNumberMinus​(int ch)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishNumberLeadingZeroes

        protected JsonToken _finishNumberLeadingZeroes()
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishNumberLeadingNegZeroes

        protected JsonToken _finishNumberLeadingNegZeroes()
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishNumberIntegralPart

        protected JsonToken _finishNumberIntegralPart​(char[] outBuf,
                                                      int outPtr)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • _startFloat

        protected JsonToken _startFloat​(char[] outBuf,
                                        int outPtr,
                                        int ch)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishFloatFraction

        protected JsonToken _finishFloatFraction()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishFloatExponent

        protected JsonToken _finishFloatExponent​(boolean checkSign,
                                                 int ch)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • _finishFieldWithEscape

        protected final JsonToken _finishFieldWithEscape()
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • _startString

        protected JsonToken _startString()
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • _startAposString

        protected JsonToken _startAposString()
                                      throws java.io.IOException
        Throws:
        java.io.IOException