InputReader

io.bullet.borer.InputReader
final class InputReader[Config <: Config](parser: Parser[_], directParser: DirectJsonParser, receiverWrapper: () => Config, config: Config, val target: Target)

Stateful, mutable abstraction for reading a stream of CBOR or JSON data from the given input.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def apply[T : Decoder]: T
def bufferUnsizedBytes[Bytes]()(implicit byteAccess: ByteAccess[Bytes]): InputReader.this.type
def bufferUnsizedTextBytes[Bytes]()(implicit byteAccess: ByteAccess[Bytes]): InputReader.this.type

If the current data item is an unsized Text item it'll be buffered and converted into a sized text item.

If the current data item is an unsized Text item it'll be buffered and converted into a sized text item.

Attributes

def charsCompare(value: Array[Char]): Int

Returns one of the following 4 values:

Returns one of the following 4 values:

  • Int.MinValue if the next data item is not a string
  • a negative value (!= Int.MinValue) a if the next data item is a string that compares as '<' to value
  • zero if the next data item is a string that compares as '==' to value
  • a positive value if the next data item is a string that compares as '>' to value

NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def cursor: Long
def dataItem(): Int
def decodeTextBytes(): InputReader.this.type

If the current data item is a sized or unsized Text item it'll be buffered and decoded into a Chars data item.

If the current data item is a sized or unsized Text item it'll be buffered and decoded into a Chars data item.

Attributes

def has(item: Int): Boolean

Checks whether the next data item is of the given type.

Checks whether the next data item is of the given type.

Example: reader.has(DataItem.Int)

Attributes

def hasAnyOf(mask: Int): Boolean

Checks whether the next data item type is masked in the given bit mask.

Checks whether the next data item type is masked in the given bit mask.

Example: reader.hasAnyOf(DataItem.Int | DataItem.Float)

Attributes

def hasArrayHeader: Boolean
def hasArrayHeader(length: Int): Boolean
def hasArrayHeader(length: Long): Boolean
def hasArrayStart: Boolean
def hasBoolean: Boolean
def hasBoolean(value: Boolean): Boolean
def hasBreak: Boolean
def hasByte: Boolean
def hasByte(value: Byte): Boolean
def hasByteArray: Boolean
def hasBytes: Boolean
def hasBytesStart: Boolean
def hasChar: Boolean
def hasChar(value: Char): Boolean
def hasChars: Boolean
def hasChars(value: Array[Char]): Boolean

Tests the next data item for equality with the given Array[Char]. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Tests the next data item for equality with the given Array[Char]. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def hasDouble: Boolean
def hasDouble(value: Double): Boolean
def hasEndOfInput: Boolean
def hasFloat: Boolean
def hasFloat(value: Float): Boolean
def hasFloat16: Boolean
def hasFloat16(value: Float): Boolean
def hasInt: Boolean
def hasInt(value: Int): Boolean
def hasLong: Boolean
def hasLong(value: Long): Boolean
def hasMapHeader: Boolean
def hasMapHeader(length: Int): Boolean
def hasMapHeader(length: Long): Boolean
def hasMapStart: Boolean
def hasNull: Boolean
def hasNumberString: Boolean
def hasNumberString(value: String): Boolean
def hasOverLong: Boolean
def hasOverLong(value: Long): Boolean
def hasShort: Boolean
def hasShort(value: Short): Boolean
def hasSimpleValue: Boolean
def hasSimpleValue(value: Int): Boolean
def hasSizedBytes: Boolean
def hasSizedTextBytes: Boolean
def hasString: Boolean
def hasString(value: String): Boolean

Tests the next data item for equality with the given String. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Tests the next data item for equality with the given String. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def hasTag: Boolean
def hasTag(tag: Tag): Boolean
def hasTextBytes: Boolean
def hasTextStart: Boolean
def hasUndefined: Boolean
def hasUnsizedBytes: Boolean
def hasUnsizedTextBytes: Boolean
def input: Input[_]
def longCompare(value: Long): Int

Returns one of the following 4 values:

Returns one of the following 4 values:

  • Int.MaxValue if the next data item is not a Long
  • minus one a if the next data item is a Long < value
  • zero if the next data item is a Long == value
  • one if the next data item is a Long > value

Attributes

def overLongNegative: Boolean
def overflow(msg: String): Nothing
def read[T]()(implicit decoder: Decoder[T]): T
def readArrayClose[T](unbounded: Boolean, value: T): T
def readArrayHeader(): Long
def readArrayHeader(length: Int): InputReader.this.type
def readArrayHeader(length: Long): InputReader.this.type
def readArrayOpen(arity: Long): Boolean
def readArrayStart(): InputReader.this.type
def readBoolean(): Boolean
def readBreak(): InputReader.this.type
def readByte(): Byte
def readByteArray(): Array[Byte]
def readBytes[Bytes : ByteAccess](): Bytes
def readBytesStart(): InputReader.this.type
def readChar(): Char
def readChars(): Array[Char]
def readChars(chars: Array[Char]): InputReader.this.type
def readDouble(): Double
def readEndOfInput(): Unit
def readFloat(): Float
def readFloat16(): Float
def readInt(): Int
def readLong(): Long
def readMapClose[T](unbounded: Boolean, value: T): T
def readMapHeader(): Long
def readMapHeader(length: Int): InputReader.this.type
def readMapHeader(length: Long): InputReader.this.type
def readMapOpen(arity: Long): Boolean
def readMapStart(): InputReader.this.type
def readNull(): Null
def readNumberString(): String
def readOverLong(): Long
def readShort(): Short
def readSimpleValue(): Int
def readSimpleValue(value: Int): InputReader.this.type
def readSizedBytes[Bytes]()(implicit byteAccess: ByteAccess[Bytes]): Bytes
def readSizedTextBytes[Bytes]()(implicit byteAccess: ByteAccess[Bytes]): Bytes
def readString(): String
def readString(s: String): InputReader.this.type
def readTag(): Tag
def readTag(tag: Tag): InputReader.this.type
def readTextBytes[Bytes : ByteAccess](): Bytes
def readTextStart(): InputReader.this.type
def readUndefined(): InputReader.this.type
def readUnsizedBytes[Bytes]()(implicit byteAccess: ByteAccess[Bytes]): Bytes
def readUnsizedTextBytes[Bytes]()(implicit byteAccess: ByteAccess[Bytes]): Bytes
def readUntilBreak[M[_], T : Decoder]()(implicit evidence$4: Decoder[T], factory: Factory[T, M[T]]): M[T]
def readUntilBreak[T](zero: T)(f: T => T): T
def readingCbor: Boolean
def readingJson: Boolean
def skipDataItem(): InputReader.this.type

Skips the current (atomic) data item.

Skips the current (atomic) data item.

CAUTION: If the data item is an Array/Map - Start/Header then this call will NOT skip the whole array or map, but only the starting data item! Use skipElement instead if you also want to skip complex elements!

Attributes

def skipElement(): InputReader.this.type

Moves the cursor beyond the current data element, thereby also skipping complex, potentially nested array or map structures.

Moves the cursor beyond the current data element, thereby also skipping complex, potentially nested array or map structures.

Attributes

def skipTwoElements(): InputReader.this.type
def stringCompare(value: String): Int

Returns one of the following 4 values:

Returns one of the following 4 values:

  • Int.MinValue if the next data item is not a string
  • a negative value (!= Int.MinValue) a if the next data item is a string that compares as '<' to value
  • zero if the next data item is a string that compares as '==' to value
  • a positive value if the next data item is a string that compares as '>' to value

NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def tryReadArrayHeader(length: Int): Boolean
def tryReadArrayHeader(length: Long): Boolean
def tryReadArrayStart(): Boolean
def tryReadBoolean(value: Boolean): Boolean
def tryReadBreak(): Boolean
def tryReadByte(value: Byte): Boolean
def tryReadBytesStart(): Boolean
def tryReadChar(value: Char): Boolean
def tryReadChars(value: Array[Char]): Boolean

Tests the next data item for equality with the given Array[Char] and advances the cursor if so. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Tests the next data item for equality with the given Array[Char] and advances the cursor if so. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def tryReadCharsCompare(value: Array[Char]): Int

Returns one of the following 4 values:

Returns one of the following 4 values:

  • Int.MinValue if the next data item is not a string
  • a negative value (!= Int.MinValue) a if the next data item is a string that compares as '<' to value
  • zero if the next data item is a string that compares as '==' to value
  • a positive value if the next data item is a string that compares as '>' to value

Advanced the cursor if the return value is zero.

NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def tryReadDouble(value: Double): Boolean
def tryReadEndOfInput(): Boolean
def tryReadFloat(value: Float): Boolean
def tryReadFloat16(value: Float): Boolean
def tryReadInt(value: Int): Boolean
def tryReadLong(value: Long): Boolean
def tryReadLongCompare(value: Long): Int
def tryReadMapHeader(length: Int): Boolean
def tryReadMapHeader(length: Long): Boolean
def tryReadMapStart(): Boolean
def tryReadNull(): Boolean
def tryReadNumberString(value: String): Boolean
def tryReadOverLong(value: Long): Boolean
def tryReadShort(value: Short): Boolean
def tryReadSimpleValue(value: Int): Boolean
def tryReadString(value: String): Boolean

Tests the next data item for equality with the given String and advances the cursor if so. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Tests the next data item for equality with the given String and advances the cursor if so. NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def tryReadStringCompare(value: String): Int

Returns one of the following 4 values:

Returns one of the following 4 values:

  • Int.MinValue if the next data item is not a string
  • a negative value (!= Int.MinValue) a if the next data item is a string that compares as '<' to value
  • zero if the next data item is a string that compares as '==' to value
  • a positive value if the next data item is a string that compares as '>' to value

Advanced the cursor if the return value is zero.

NOTE: This method causes text bytes (sized or unsized) to be buffered and converted to Chars data items!

Attributes

def tryReadTag(tag: Tag): Boolean
def tryReadTextStart(): Boolean
def tryReadUndefined(): Boolean
def unexpectedDataItem(expected: String): Nothing
def unexpectedDataItem(expected: String, actual: String): Nothing
def validationFailure(msg: String): Nothing

Concrete fields

val target: Target