JsonWriter

com.github.plokhotnyuk.jsoniter_scala.core.JsonWriter
See theJsonWriter companion object
final class JsonWriter

A writer for iterative serialization of JSON keys and values.

Attributes

bbuf

a byte buffer for writing JSON data

buf

an internal buffer for writing JSON data

comma

a flag indicating if the next element should be preceded by comma

config

a writer configuration

count

the current position in the internal buffer

disableBufGrowing

a flag indicating if growing of the internal buffer is disabled

indention

the current indention level

limit

the last position in the internal buffer

out

the output stream for writing JSON data

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def encodeError(msg: String): Nothing

Throws a JsonWriterException with the given error message.

Throws a JsonWriterException with the given error message.

Attributes

msg

the error message

Throws:
def writeArrayEnd(): Unit

Writes a JSON array end marker (]).

Writes a JSON array end marker (]).

Attributes

def writeArrayStart(): Unit

Writes a JSON array start marker ([).

Writes a JSON array start marker ([).

Attributes

def writeBase16Val(bs: Array[Byte], lowerCase: Boolean): Unit

Writes a byte array as a JSON hexadecimal string value.

Writes a byte array as a JSON hexadecimal string value.

Attributes

bs

the byte array to write

lowerCase

if true, outputs lowercase hexadecimal digits

def writeBase64UrlVal(bs: Array[Byte], doPadding: Boolean): Unit

Writes a byte array as a JSON string value encoded in a base-64 format for URLs.

Writes a byte array as a JSON string value encoded in a base-64 format for URLs.

Attributes

bs

the byte array to write

doPadding

if true, outputs padding characters (=) as needed

def writeBase64Val(bs: Array[Byte], doPadding: Boolean): Unit

Writes a byte array as a JSON string value encoded in a base-64 format.

Writes a byte array as a JSON string value encoded in a base-64 format.

Attributes

bs

the byte array to write

doPadding

if true, outputs padding characters (=) as needed

def writeKey(x: Boolean): Unit

Writes a Boolean value as a JSON key.

Writes a Boolean value as a JSON key.

Attributes

x

the Boolean value to write

def writeKey(x: Byte): Unit

Writes a Byte value as a JSON key.

Writes a Byte value as a JSON key.

Attributes

x

the Byte value to write

def writeKey(x: Char): Unit

Writes a Char value as a JSON key.

Writes a Char value as a JSON key.

Attributes

x

the Char value to write

Throws:
JsonWriterException

in case of Char value is a part of surrogate pair

def writeKey(x: Short): Unit

Writes a Short value as a JSON key.

Writes a Short value as a JSON key.

Attributes

x

the Short value to write

def writeKey(x: Int): Unit

Writes a Int value as a JSON key.

Writes a Int value as a JSON key.

Attributes

x

the Int value to write

def writeKey(x: Long): Unit

Writes a Long value as a JSON key.

Writes a Long value as a JSON key.

Attributes

x

the Long value to write

def writeKey(x: Float): Unit

Writes a Float value as a JSON key.

Writes a Float value as a JSON key.

Attributes

x

the Float value to write

Throws:
JsonWriterException

if the value is non-finite

def writeKey(x: Double): Unit

Writes a Double value as a JSON key.

Writes a Double value as a JSON key.

Attributes

x

the Double value to write

Throws:
JsonWriterException

if the value is non-finite

def writeKey(x: BigInt): Unit

Writes a BigInt value as a JSON key.

Writes a BigInt value as a JSON key.

Attributes

x

the BigInt value to write

def writeKey(x: BigDecimal): Unit

Writes a BigDecimal value as a JSON key.

Writes a BigDecimal value as a JSON key.

Attributes

x

the BigDecimal value to write

def writeKey(x: UUID): Unit

Writes a java.util.UUID value as a JSON key.

Writes a java.util.UUID value as a JSON key.

Attributes

x

the java.util.UUID value to write

def writeKey(x: String): Unit

Writes a String value as a JSON key.

Writes a String value as a JSON key.

Attributes

x

the String value to write

Throws:
JsonWriterException

if the provided string has an illegal surrogate pair

def writeKey(x: Duration): Unit

Writes a java.time.Duration value as a JSON key.

Writes a java.time.Duration value as a JSON key.

Attributes

x

the java.time.Duration value to write

def writeKey(x: Instant): Unit

Writes a java.time.Duration value as a JSON key.

Writes a java.time.Duration value as a JSON key.

Attributes

x

the java.time.Duration value to write

def writeKey(x: LocalDate): Unit

Writes a java.time.LocalDate value as a JSON key.

Writes a java.time.LocalDate value as a JSON key.

Attributes

x

the java.time.LocalDate value to write

def writeKey(x: LocalDateTime): Unit

Writes a java.time.LocalDateTime value as a JSON key.

Writes a java.time.LocalDateTime value as a JSON key.

Attributes

x

the java.time.LocalDateTime value to write

def writeKey(x: LocalTime): Unit

Writes a java.time.LocalTime value as a JSON key.

Writes a java.time.LocalTime value as a JSON key.

Attributes

x

the java.time.LocalTime value to write

def writeKey(x: MonthDay): Unit

Writes a java.time.MonthDay value as a JSON key.

Writes a java.time.MonthDay value as a JSON key.

Attributes

x

the java.time.MonthDay value to write

def writeKey(x: OffsetDateTime): Unit

Writes a java.time.OffsetDateTime value as a JSON key.

Writes a java.time.OffsetDateTime value as a JSON key.

Attributes

x

the java.time.OffsetDateTime value to write

def writeKey(x: OffsetTime): Unit

Writes a java.time.OffsetTime value as a JSON key.

Writes a java.time.OffsetTime value as a JSON key.

Attributes

x

the java.time.OffsetTime value to write

def writeKey(x: Period): Unit

Writes a java.time.Period value as a JSON key.

Writes a java.time.Period value as a JSON key.

Attributes

x

the java.time.Period value to write

def writeKey(x: Year): Unit

Writes a java.time.Year value as a JSON key.

Writes a java.time.Year value as a JSON key.

Attributes

x

the java.time.Year value to write

def writeKey(x: YearMonth): Unit

Writes a java.time.YearMonth value as a JSON key.

Writes a java.time.YearMonth value as a JSON key.

Attributes

x

the java.time.YearMonth value to write

def writeKey(x: ZonedDateTime): Unit

Writes a java.time.ZonedDateTime value as a JSON key.

Writes a java.time.ZonedDateTime value as a JSON key.

Attributes

x

the java.time.ZonedDateTime value to write

def writeKey(x: ZoneId): Unit

Writes a java.time.ZoneId value as a JSON key.

Writes a java.time.ZoneId value as a JSON key.

Attributes

x

the java.time.ZoneId value to write

def writeKey(x: ZoneOffset): Unit

Writes a java.time.ZoneOffset value as a JSON key.

Writes a java.time.ZoneOffset value as a JSON key.

Attributes

x

the java.time.ZoneOffset value to write

def writeNonEscapedAsciiKey(x: String): Unit

Writes a String value that doesn't require encoding or escaping as a JSON key.

Writes a String value that doesn't require encoding or escaping as a JSON key.

Attributes

x

the String value to write

Note:

Use JsonWriter.isNonEscapedAscii for validation if the string is eligable for writing by this method.

def writeNonEscapedAsciiVal(x: String): Unit

Writes a String value that doesn't require encoding or escaping as a JSON value.

Writes a String value that doesn't require encoding or escaping as a JSON value.

Attributes

x

the String value to write

Note:

Use JsonWriter.isNonEscapedAscii for validation if the string is eligable for writing by this method.

def writeNull(): Unit

Writes a JSON null value.

Writes a JSON null value.

Attributes

def writeObjectEnd(): Unit

Writes a JSON array end marker (}).

Writes a JSON array end marker (}).

Attributes

def writeObjectStart(): Unit

Writes a JSON array start marker ({).

Writes a JSON array start marker ({).

Attributes

def writeRawVal(bs: Array[Byte]): Unit

Writes a byte array as a JSON raw binary value.

Writes a byte array as a JSON raw binary value.

Attributes

bs

the byte array to write

def writeVal(x: BigDecimal): Unit

Writes a BigDecimal value as a JSON value.

Writes a BigDecimal value as a JSON value.

Attributes

x

the BigDecimal value to write

def writeVal(x: BigInt): Unit

Writes a BigInt value as a JSON value.

Writes a BigInt value as a JSON value.

Attributes

x

the BigInt value to write

def writeVal(x: UUID): Unit

Writes a java.util.UUID value as a JSON value.

Writes a java.util.UUID value as a JSON value.

Attributes

x

the java.util.UUID value to write

def writeVal(x: String): Unit

Writes a String value as a JSON value.

Writes a String value as a JSON value.

Attributes

x

the String value to write

Throws:
JsonWriterException

if the provided string has an illegal surrogate pair

def writeVal(x: Duration): Unit

Writes a java.time.Duration value as a JSON value.

Writes a java.time.Duration value as a JSON value.

Attributes

x

the java.time.Duration value to write

def writeVal(x: Instant): Unit

Writes a java.time.Instant value as a JSON value.

Writes a java.time.Instant value as a JSON value.

Attributes

x

the java.time.Instant value to write

def writeVal(x: LocalDate): Unit

Writes a java.time.LocalDate value as a JSON value.

Writes a java.time.LocalDate value as a JSON value.

Attributes

x

the java.time.LocalDate value to write

def writeVal(x: LocalDateTime): Unit

Writes a java.time.LocalDateTime value as a JSON value.

Writes a java.time.LocalDateTime value as a JSON value.

Attributes

x

the java.time.LocalDateTime value to write

def writeVal(x: LocalTime): Unit

Writes a java.time.LocalTime value as a JSON value.

Writes a java.time.LocalTime value as a JSON value.

Attributes

x

the java.time.LocalTime value to write

def writeVal(x: MonthDay): Unit

Writes a java.time.MonthDay value as a JSON value.

Writes a java.time.MonthDay value as a JSON value.

Attributes

x

the java.time.MonthDay value to write

def writeVal(x: OffsetDateTime): Unit

Writes a java.time.OffsetDateTime value as a JSON value.

Writes a java.time.OffsetDateTime value as a JSON value.

Attributes

x

the java.time.OffsetDateTime value to write

def writeVal(x: OffsetTime): Unit

Writes a java.time.OffsetTime value as a JSON value.

Writes a java.time.OffsetTime value as a JSON value.

Attributes

x

the java.time.OffsetTime value to write

def writeVal(x: Period): Unit

Writes a java.time.Period value as a JSON value.

Writes a java.time.Period value as a JSON value.

Attributes

x

the java.time.Period value to write

def writeVal(x: Year): Unit

Writes a java.time.Year value as a JSON value.

Writes a java.time.Year value as a JSON value.

Attributes

x

the java.time.Year value to write

def writeVal(x: YearMonth): Unit

Writes a java.time.YearMonth value as a JSON value.

Writes a java.time.YearMonth value as a JSON value.

Attributes

x

the java.time.YearMonth value to write

def writeVal(x: ZonedDateTime): Unit

Writes a java.time.ZonedDateTime value as a JSON value.

Writes a java.time.ZonedDateTime value as a JSON value.

Attributes

x

the java.time.ZonedDateTime value to write

def writeVal(x: ZoneId): Unit

Writes a java.time.ZoneId value as a JSON value.

Writes a java.time.ZoneId value as a JSON value.

Attributes

x

the java.time.ZoneId value to write

def writeVal(x: ZoneOffset): Unit

Writes a java.time.ZoneOffset value as a JSON value.

Writes a java.time.ZoneOffset value as a JSON value.

Attributes

x

the java.time.ZoneOffset value to write

def writeVal(x: Boolean): Unit

Writes a Boolean value as a JSON value.

Writes a Boolean value as a JSON value.

Attributes

x

the Boolean value to write

def writeVal(x: Byte): Unit

Writes a Byte value as a JSON value.

Writes a Byte value as a JSON value.

Attributes

x

the Byte value to write

def writeVal(x: Short): Unit

Writes a Short value as a JSON value.

Writes a Short value as a JSON value.

Attributes

x

the Short value to write

def writeVal(x: Char): Unit

Writes a Char value as a JSON key.

Writes a Char value as a JSON key.

Attributes

x

the Char value to write

Throws:
JsonWriterException

in case of Char value is a part of surrogate pair

def writeVal(x: Int): Unit

Writes a Int value as a JSON value.

Writes a Int value as a JSON value.

Attributes

x

the Int value to write

def writeVal(x: Long): Unit

Writes a Long value as a JSON value.

Writes a Long value as a JSON value.

Attributes

x

the Long value to write

def writeVal(x: Float): Unit

Writes a Float value as a JSON value.

Writes a Float value as a JSON value.

Attributes

x

the Float value to write

Throws:
JsonWriterException

if the value is non-finite

def writeVal(x: Double): Unit

Writes a Double value as a JSON value.

Writes a Double value as a JSON value.

Attributes

x

the Double value to write

Throws:
JsonWriterException

if the value is non-finite

def writeValAsString(x: BigDecimal): Unit

Writes a BigDecimal value as a JSON string value.

Writes a BigDecimal value as a JSON string value.

Attributes

x

the BigDecimal value to write

def writeValAsString(x: BigInt): Unit

Writes a BigInt value as a JSON string value.

Writes a BigInt value as a JSON string value.

Attributes

x

the BigInt value to write

def writeValAsString(x: Boolean): Unit

Writes a Boolean value as a JSON string value.

Writes a Boolean value as a JSON string value.

Attributes

x

the Boolean value to write

def writeValAsString(x: Byte): Unit

Writes a Byte value as a JSON string value.

Writes a Byte value as a JSON string value.

Attributes

x

the Byte value to write

def writeValAsString(x: Short): Unit

Writes a Short value as a JSON string value.

Writes a Short value as a JSON string value.

Attributes

x

the Short value to write

def writeValAsString(x: Int): Unit

Writes a Int value as a JSON string value.

Writes a Int value as a JSON string value.

Attributes

x

the Int value to write

def writeValAsString(x: Long): Unit

Writes a Long value as a JSON string value.

Writes a Long value as a JSON string value.

Attributes

x

the Long value to write

def writeValAsString(x: Float): Unit

Writes a Float value as a JSON string value.

Writes a Float value as a JSON string value.

Attributes

x

the Float value to write

Throws:
JsonWriterException

if the value is non-finite

def writeValAsString(x: Double): Unit

Writes a Double value as a JSON string value.

Writes a Double value as a JSON string value.

Attributes

x

the Double value to write

Throws:
JsonWriterException

if the value is non-finite