final class InputStreamParser[J] extends ByteParser[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
- Alphabetic
- By Inheritance
- InputStreamParser
- BufferingInputStreamParser
- ByteParser
- BufferingByteParser
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new InputStreamParser(inputStream: InputStream, minBufferStartSize: Int = ..., maxBufferStartSize: Int = ...)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
appendBytesToBuilder(elems: ByteBuilder, elemsStart: Int, elemsLength: Int): Unit
- Definition Classes
- BufferingByteParser
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
atEof(i: Int): Boolean
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
- ByteParser
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
close(): Unit
Should be called when parsing is finished.
Should be called when parsing is finished.
- Attributes
- protected[this]
- Definition Classes
- InputStreamParser → ByteParser
-
def
collectionEndFor(stackHead: ObjArrVisitor[_, _]): Int
- Definition Classes
- ByteParser
-
final
def
descape(i: Int): Char
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
- ByteParser
-
def
die(i: Int, msg: String): Nothing
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
- ByteParser
-
def
dieWithFailureMessage(i: Int, state: Int): Nothing
- Definition Classes
- ByteParser
-
def
dropBufferUntil(i: Int): Unit
- Definition Classes
- BufferingByteParser
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
failIfNotData(state: Int, i: Int): Unit
- Definition Classes
- ByteParser
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
getBufferCopyCount(): Int
- Definition Classes
- BufferingByteParser
-
def
getBufferGrowCount(): Int
- Definition Classes
- BufferingByteParser
-
def
getBufferLength(): Int
- Definition Classes
- BufferingByteParser
-
def
getByteSafe(i: Int): Byte
- Definition Classes
- ByteParser → BufferingByteParser
-
def
getByteUnsafe(i: Int): Byte
- Definition Classes
- BufferingByteParser
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getLastIdx: Int
- Definition Classes
- BufferingByteParser
-
def
growBuffer(until: Int): Unit
- Definition Classes
- BufferingByteParser
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
val
inputStream: InputStream
- Definition Classes
- InputStreamParser → BufferingInputStreamParser
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
maxBufferStartSize: Int
- Definition Classes
- InputStreamParser → BufferingInputStreamParser
-
val
minBufferStartSize: Int
- Definition Classes
- InputStreamParser → BufferingInputStreamParser
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
parse(facade: Visitor[_, J]): J
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
- ByteParser
-
final
def
parseFalse(i: Int, facade: Visitor[_, J]): J
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
- ByteParser
-
final
def
parseNested(state: Int, i: Int, stackHead: ObjArrVisitor[_, J], stackTail: List[ObjArrVisitor[_, J]]): (J, Int)
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.
- Attributes
- protected[this]
- Definition Classes
- ByteParser
- Annotations
- @tailrec()
-
final
def
parseNull(i: Int, facade: Visitor[_, J]): J
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
- ByteParser
-
final
def
parseNum(i: Int, ctxt: ObjArrVisitor[Any, J], facade: Visitor[_, J]): Int
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
- ByteParser
-
final
def
parseNumTopLevel(i: Int, facade: Visitor[_, J]): (J, Int)
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
- ByteParser
-
final
def
parseStringComplex(i0: Int): Int
Parse a string that is known to have escape sequences.
Parse a string that is known to have escape sequences.
- Attributes
- protected[this]
- Definition Classes
- ByteParser
-
final
def
parseStringKey(i: Int, stackHead: ObjArrVisitor[_, J]): Int
- Attributes
- protected[this]
- Definition Classes
- ByteParser
-
final
def
parseStringSimple(i: Int): Int
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-16 and accesses it as chars.
- Attributes
- protected[this]
- Definition Classes
- ByteParser
-
def
parseStringToOutputBuilder(i: Int, k: Int): Int
- Definition Classes
- ByteParser
-
final
def
parseStringTopLevel(i: Int, facade: Visitor[_, J]): (J, Int)
- Attributes
- protected[this]
- Definition Classes
- ByteParser
-
final
def
parseStringValue(i: Int, stackHead: ObjArrVisitor[_, J]): Int
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-16, and access it as Char. It performs the correct checks to make sure that we don't interpret a multi-char code point incorrectly.
- Attributes
- protected[this]
- Definition Classes
- ByteParser
-
final
def
parseTopLevel(i: Int, facade: Visitor[_, J]): (J, Int)
- Attributes
- protected[this]
- Definition Classes
- ByteParser
-
final
def
parseTopLevel0(i: Int, facade: Visitor[_, J]): (J, Int)
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
- ByteParser
- Annotations
- @tailrec()
-
final
def
parseTrue(i: Int, facade: Visitor[_, J]): J
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
- ByteParser
-
def
readDataIntoBuffer(buffer: Array[Byte], bufferOffset: Int): (Array[Byte], Boolean, Int)
- Definition Classes
- BufferingInputStreamParser → BufferingByteParser
-
def
reject(j: Int): PartialFunction[Throwable, Nothing]
- Definition Classes
- ByteParser
-
def
requestUntil(until: Int): Boolean
- Attributes
- protected
- Definition Classes
- BufferingByteParser
-
def
requestUntilOrThrow(i: Int): Unit
- Definition Classes
- ByteParser
-
def
sliceArr(i: Int, n: Int): (Array[Byte], Int, Int)
- Definition Classes
- BufferingByteParser
-
def
sliceString(i: Int, k: Int): String
- Definition Classes
- BufferingByteParser
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
tryCloseCollection(stackHead: ObjArrVisitor[_, J], stackTail: List[ObjArrVisitor[_, J]], i: Int): Option[(J, Int)]
- Definition Classes
- ByteParser
-
def
unsafeCharSeqForRange(start: Int, length: Int): WrapByteArrayCharSeq
- Definition Classes
- BufferingByteParser
-
def
visitFloat64StringPartsWithWrapper(facade: Visitor[_, J], decIndex: Int, expIndex: Int, i: Int, j: Int): J
- Definition Classes
- ByteParser
-
def
visitString(i: Int, s: CharSequence, stackHead: ObjArrVisitor[_, J]): Unit
- Definition Classes
- ByteParser
-
def
visitStringKey(i: Int, s: CharSequence, stackHead: ObjArrVisitor[_, J]): Unit
- Definition Classes
- ByteParser
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()