Class/Object

ujson

InputStreamParser

Related Docs: object InputStreamParser | package ujson

Permalink

final class InputStreamParser[J] extends Parser[J] with ByteBasedParser[J] with BufferingInputStreamParser

Parser that reads in bytes from an InputStream, buffering them in memory until a reset call discards them.

Mostly the same as ByteArrayParser, except using an UberBuffer rather than reading directly from an Array[Byte].

Generally not meant to be used directly, but via ujson.Readable.fromReadable

Linear Supertypes
BufferingInputStreamParser, ByteBasedParser[J], Parser[J], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InputStreamParser
  2. BufferingInputStreamParser
  3. ByteBasedParser
  4. Parser
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new InputStreamParser(data: InputStream, minStartBufferSize: Int, maxStartBufferSize: Int)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final val ARRBEG: Int(6)

    Permalink

    Valid parser states.

    Valid parser states.

    Attributes
    protected[this]
    Definition Classes
    Parser
  5. final val ARREND: Int(4)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  6. final val DATA: Int(1)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  7. final val HexChars: Array[Int]

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  8. final val KEY: Int(2)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  9. final val KEYVALUE: Int(2)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  10. final val OBJBEG: Int(7)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  11. final val OBJEND: Int(5)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  12. final val SEP: Int(3)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. final def atEof(i: Int): Boolean

    Permalink

    Return true iff 'i' is at or beyond the end of the input (EOF).

    Return true iff 'i' is at or beyond the end of the input (EOF).

    Attributes
    protected[this]
    Definition Classes
    InputStreamParserParser
  15. def byte(i: Int): Byte

    Permalink
    Definition Classes
    BufferingInputStreamParser
  16. final def char(i: Int): Char

    Permalink

    Read the byte/char at 'i' as a Char.

    Read the byte/char at 'i' as a Char.

    Note that this should not be used on potential multi-byte sequences.

    Attributes
    protected[this]
    Definition Classes
    InputStreamParserParser
  17. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  18. final def close(): Unit

    Permalink

    Should be called when parsing is finished.

    Should be called when parsing is finished.

    Attributes
    protected[this]
    Definition Classes
    InputStreamParserParser
  19. final def column(i: Int): Int

    Permalink
    Attributes
    protected[this]
    Definition Classes
    InputStreamParserParser
  20. val data: InputStream

    Permalink
    Definition Classes
    InputStreamParser → BufferingInputStreamParser
  21. final def descape(s: CharSequence): Char

    Permalink

    Generate a Char from the hex digits of "ሴ" (i.e.

    Generate a Char from the hex digits of "ሴ" (i.e. "1234").

    NOTE: This is only capable of generating characters from the basic plane. This is why it can only return Char instead of Int.

    Attributes
    protected[this]
    Definition Classes
    Parser
  22. def die(i: Int, msg: String): Nothing

    Permalink

    Used to generate error messages with character info and offsets.

    Used to generate error messages with character info and offsets.

    Attributes
    protected[this]
    Definition Classes
    Parser
  23. def dropBufferUntil(i: Int): Unit

    Permalink
    Definition Classes
    BufferingInputStreamParser
  24. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  26. def error(msg: String): Nothing

    Permalink

    Used to generate messages for internal errors.

    Used to generate messages for internal errors.

    This should only be used in situations where a possible bug in the parser was detected. For errors in user-provided JSON, use die().

    Attributes
    protected[this]
    Definition Classes
    Parser
  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  28. def getLastIdx: Int

    Permalink
    Definition Classes
    BufferingInputStreamParser
  29. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  30. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  31. def line: Int

    Permalink
    Attributes
    protected[this]
    Definition Classes
    InputStreamParserParser
  32. val maxStartBufferSize: Int

    Permalink
    Definition Classes
    InputStreamParser → BufferingInputStreamParser
  33. val minStartBufferSize: Int

    Permalink
    Definition Classes
    InputStreamParser → BufferingInputStreamParser
  34. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  35. final def newline(i: Int): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    InputStreamParserParser
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  38. final def parse(i: Int, facade: Visitor[_, J]): (J, Int)

    Permalink

    Parse and return the next JSON value and the position beyond it.

    Parse and return the next JSON value and the position beyond it.

    Attributes
    protected[this]
    Definition Classes
    Parser
  39. final def parse(facade: Visitor[_, J]): J

    Permalink

    Parse the JSON document into a single JSON value.

    Parse the JSON document into a single JSON value.

    The parser considers documents like '333', 'true', and '"foo"' to be valid, as well as more traditional documents like [1,2,3,4,5]. However, multiple top-level objects are not allowed.

    Definition Classes
    Parser
  40. final def parseFalse(i: Int, facade: Visitor[_, J]): J

    Permalink

    Parse the JSON constant "false".

    Parse the JSON constant "false".

    Note that this method assumes that the first character has already been checked.

    Attributes
    protected[this]
    Definition Classes
    Parser
  41. final def parseNull(i: Int, facade: Visitor[_, J]): J

    Permalink

    Parse the JSON constant "null".

    Parse the JSON constant "null".

    Note that this method assumes that the first character has already been checked.

    Attributes
    protected[this]
    Definition Classes
    Parser
  42. final def parseNum(i: Int, ctxt: ObjArrVisitor[Any, J], facade: Visitor[_, J]): Int

    Permalink

    Parse the given number, and add it to the given context.

    Parse the given number, and add it to the given context.

    We don't actually instantiate a number here, but rather pass the string of for future use. Facades can choose to be lazy and just store the string. This ends up being way faster and has the nice side-effect that we know exactly how the user represented the number.

    Attributes
    protected[this]
    Definition Classes
    Parser
  43. final def parseNumSlow(i: Int, facade: Visitor[_, J]): (J, Int)

    Permalink

    Parse the given number, and add it to the given context.

    Parse the given number, and add it to the given context.

    This method is a bit slower than parseNum() because it has to be sure it doesn't run off the end of the input.

    Normally (when operating in rparse in the context of an outer array or object) we don't need to worry about this and can just grab characters, because if we run out of characters that would indicate bad input. This is for cases where the number could possibly be followed by a valid EOF.

    This method has all the same caveats as the previous method.

    Attributes
    protected[this]
    Definition Classes
    Parser
  44. final def parseString(i: Int, key: Boolean): (CharSequence, Int)

    Permalink

    Parse the string according to JSON rules, and add to the given context.

    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.

    Attributes
    protected[this]
    Definition Classes
    ByteBasedParserParser
  45. final def parseStringComplex(i: Int): (String, Int)

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ByteBasedParser
  46. final def parseStringSimple(i: Int): Int

    Permalink

    See if the string has any escape sequences.

    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.

    Attributes
    protected[this]
    Definition Classes
    ByteBasedParser
  47. final def parseTrue(i: Int, facade: Visitor[_, J]): J

    Permalink

    Parse the JSON constant "true".

    Parse the JSON constant "true".

    Note that this method assumes that the first character has already been checked.

    Attributes
    protected[this]
    Definition Classes
    Parser
  48. def readDataIntoBuffer(): Boolean

    Permalink
    Definition Classes
    BufferingInputStreamParser
  49. def reject(j: Int): PartialFunction[Throwable, Nothing]

    Permalink
    Definition Classes
    Parser
  50. def requestUntil(until: Int): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    InputStreamParser → BufferingInputStreamParser
  51. final def rparse(state: Int, j: Int, stack: List[ObjArrVisitor[_, J]]): (J, Int)

    Permalink

    Tail-recursive parsing method to do the bulk of JSON parsing.

    Tail-recursive parsing method to do the bulk of JSON parsing.

    This single method manages parser states, data, etc. Except for parsing non-recursive values (like strings, numbers, and constants) all important work happens in this loop (or in methods it calls, like reset()).

    Currently the code is optimized to make use of switch statements. Future work should consider whether this is better or worse than manually constructed if/else statements or something else. Also, it may be possible to reorder some cases for speed improvements.

    j

    index/position in the source json

    Attributes
    protected[this]
    Definition Classes
    Parser
    Annotations
    @tailrec()
  52. def sliceBytes(i: Int, n: Int): (Array[Byte], Int, Int)

    Permalink
    Definition Classes
    BufferingInputStreamParser
  53. def sliceString(i: Int, k: Int): String

    Permalink
    Definition Classes
    BufferingInputStreamParser
  54. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  55. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  56. final val utf8: Charset

    Permalink
    Attributes
    protected[this]
    Definition Classes
    Parser
  57. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from BufferingInputStreamParser

Inherited from ByteBasedParser[J]

Inherited from Parser[J]

Inherited from AnyRef

Inherited from Any

Ungrouped