JsonValueSource

This source reads a prefix of another source as a JSON value and then terminates. It can read top-level arrays, objects, or strings only.

It implements lenient parsing and has no mechanism to enforce strict parsing. If the input is not valid or lenient JSON the behavior of this source is unspecified.

class JsonValueSource : Source

Constructors

JsonValueSource
Link copied to clipboard
open fun JsonValueSource(source: BufferedSource)
JsonValueSource
Link copied to clipboard
open fun JsonValueSource(source: BufferedSource, prefix: Buffer, state: ByteString, stackSize: Int)

Functions

close
Link copied to clipboard
open fun close()
abstract fun close()
discard
Link copied to clipboard

Discards any remaining JSON data in this source that was left behind after it was closed. It is an error to call read after calling this method.

open fun discard()
read
Link copied to clipboard
open fun read(sink: Buffer, byteCount: Long): Long
abstract fun read(p: Buffer, p1: Long): Long
timeout
Link copied to clipboard
open fun timeout(): Timeout
abstract fun timeout(): Timeout

Properties

STATE_C_STYLE_COMMENT
Link copied to clipboard
val STATE_C_STYLE_COMMENT: ByteString
STATE_DOUBLE_QUOTED
Link copied to clipboard
val STATE_DOUBLE_QUOTED: ByteString
STATE_END_OF_JSON
Link copied to clipboard
val STATE_END_OF_JSON: ByteString
STATE_END_OF_LINE_COMMENT
Link copied to clipboard
val STATE_END_OF_LINE_COMMENT: ByteString
STATE_JSON
Link copied to clipboard
val STATE_JSON: ByteString
STATE_SINGLE_QUOTED
Link copied to clipboard
val STATE_SINGLE_QUOTED: ByteString