Interface ByteBasedParser<J>

All Known Implementing Classes:
PimpedAsyncParser

public interface ByteBasedParser<J>
Trait used when the data to be parsed is in UTF-8.

This parser has to translate input bytes to Chars and Strings. It provides a byte() method to access individual bytes, and also parser strings from bytes.

Its parseString() implementation has two cases. In the first case (the hot path) the string has no escape sequences and we can just UTF-8 decode the entire set of bytes. In the second case, it goes to some trouble to be sure to de-escape correctly given that the input data is UTF-8.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    parseString(int i, RawFContext<J> ctxt)
    Parse the string according to JSON rules, and add to the given context.
    int
    See if the string has any escape sequences.
  • Method Details

    • parseString

      int parseString(int i, RawFContext<J> ctxt)
      Parse the string according to JSON rules, and add to the given context.

      This method expects the data to be in UTF-8 and accesses it as bytes.

    • parseStringSimple

      int parseStringSimple(int i, RawFContext<J> ctxt)
      See if the string has any escape sequences. If not, return the end of the string. If so, bail out and return -1.

      This method expects the data to be in UTF-8 and accesses it as bytes. Thus we can just ignore any bytes with the highest bit set.