ByteArrayParser

ujson.ByteArrayParser
See theByteArrayParser companion object
final class ByteArrayParser[J](src: Array[Byte]) extends ByteParser[J]

Basic ByteBuffer parser.

This assumes that the provided ByteBuffer is ready to be read. The user is responsible for any necessary flipping/resetting of the ByteBuffer before parsing.

The parser makes absolute calls to the ByteBuffer, which will not update its own mutable position fields.

Attributes

Companion
object
Graph
Supertypes
class ByteParser[J]
trait BufferingByteParser
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def growBuffer(until: Int): Unit

Copies the non-dropped Bytes in the current buffer to the start of either the current buffer, or a newly-allocated larger buffer if necessary.

Copies the non-dropped Bytes in the current buffer to the start of either the current buffer, or a newly-allocated larger buffer if necessary.

Attributes

Definition Classes
BufferingByteParser
def readDataIntoBuffer(buffer: Array[Byte], bufferOffset: Int): (Array[Byte], Boolean, Int)

Inherited methods

def appendBytesToBuilder(bytes: ByteBuilder, bytesStart: Int, bytesLength: Int): Unit

Attributes

Inherited from:
BufferingByteParser
def checkSafeIndex(j: Int): Int

Attributes

Inherited from:
ByteParser
def collectionEndFor(stackHead: ObjArrVisitor[_, _]): Int

Attributes

Inherited from:
ByteParser
def dieWithFailureMessage(i: Int, state: Int): Nothing

Attributes

Inherited from:
ByteParser
def dropBufferUntil(i: Int): Unit

Attributes

Inherited from:
BufferingByteParser
def failIfNotData(state: Int, i: Int): Unit

Attributes

Inherited from:
ByteParser
def getBuffer: Array[Byte]

Attributes

Inherited from:
BufferingByteParser
def getBufferCopyCount(): Int

Attributes

Inherited from:
BufferingByteParser
def getBufferGrowCount(): Int

Attributes

Inherited from:
BufferingByteParser
def getBufferLength(): Int

Attributes

Inherited from:
BufferingByteParser
override def getByteSafe(i: Int): Byte

Attributes

Definition Classes
ByteParser -> BufferingByteParser
Inherited from:
ByteParser
def getByteUnsafe(i: Int): Byte

Attributes

Inherited from:
BufferingByteParser
def getFirstIdx: Int

Attributes

Inherited from:
BufferingByteParser
def getLastIdx: Int

Attributes

Inherited from:
BufferingByteParser
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.

Attributes

Inherited from:
ByteParser
def parseStringToOutputBuilder(i: Int, k: Int): Int

Attributes

Inherited from:
ByteParser
def reject(j: Int): PartialFunction[Throwable, Nothing]

Attributes

Inherited from:
ByteParser
protected def requestUntil(until: Int): Boolean

Used to ensure that byteents up to until are available to read; returns whether or not we have read off the end of the input.

Used to ensure that byteents up to until are available to read; returns whether or not we have read off the end of the input.

In the fast path, when until is less than the lastIdx we have buffered, there is no work to do and we return false.

In the slow path, when until is more than lastIdx, we then run growBuffer to grow the buffer if necessary, and then readDataIntoBuffer to populate it. readDataIntoBuffer returns a newDone value to indicate whether we have read off the end of the input or not.

Note that for some subclasses, growBuffer may be a no-op when we already know we have reached the end of input.

Attributes

Inherited from:
BufferingByteParser
protected def requestUntilGetSafeIndex(until: Int): Int

Used to ask for data up to a certain index, as a best effort (unlike requestUntil), returning the "safe index" which it was actually able to fetch data for. This is used so the caller can use the safe index to know how far it is able to run getByteUnsafe calls without further checks, improving performance over calling getByteSafe every time which performs additional checks and logic

Used to ask for data up to a certain index, as a best effort (unlike requestUntil), returning the "safe index" which it was actually able to fetch data for. This is used so the caller can use the safe index to know how far it is able to run getByteUnsafe calls without further checks, improving performance over calling getByteSafe every time which performs additional checks and logic

Attributes

Inherited from:
BufferingByteParser
def requestUntilOrThrow(j: Int): Unit

A fast-path to check whether an index can be safely accessed, before calling getByteUnsafe. Together, it is similar to calling getByteSafe, except this returns the new safeIndex which the caller can then use to call getByteUnsafe multiple times before needing to call this again.

A fast-path to check whether an index can be safely accessed, before calling getByteUnsafe. Together, it is similar to calling getByteSafe, except this returns the new safeIndex which the caller can then use to call getByteUnsafe multiple times before needing to call this again.

Attributes

Inherited from:
ByteParser
def sliceArr(i: Int, n: Int): (Array[Byte], Int, Int)

Attributes

Inherited from:
BufferingByteParser
def sliceString(i: Int, k: Int): String

Attributes

Inherited from:
BufferingByteParser
def tryCloseCollection(stackHead: ObjArrVisitor[_, J], stackTail: List[ObjArrVisitor[_, J]], i: Int): Option[(J, Int)]

Attributes

Inherited from:
ByteParser
def unsafeCharSeqForRange(start: Int, length: Int): WrapByteArrayCharSeq

Attributes

Inherited from:
BufferingByteParser
def visitFloat64StringPartsWithWrapper(facade: Visitor[_, J], decIndex: Int, expIndex: Int, i: Int, j: Int): J

Attributes

Inherited from:
ByteParser
def visitString(i: Int, s: CharSequence, stackHead: ObjArrVisitor[_, J]): Unit

Attributes

Inherited from:
ByteParser
def visitStringKey(i: Int, s: CharSequence, stackHead: ObjArrVisitor[_, J]): Unit

Attributes

Inherited from:
ByteParser

Concrete fields

val srcLength: Int