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.

Value parameters

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

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

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.

Value parameters

msg

the error message

Attributes

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.

Value parameters

bs

the byte array to write

lowerCase

if true, outputs lowercase hexadecimal digits

Attributes

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.

Value parameters

bs

the byte array to write

doPadding

if true, outputs padding characters (=) as needed

Attributes

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.

Value parameters

bs

the byte array to write

doPadding

if true, outputs padding characters (=) as needed

Attributes

def writeKey(x: Boolean): Unit

Writes a Boolean value as a JSON key.

Writes a Boolean value as a JSON key.

Value parameters

x

the Boolean value to write

Attributes

def writeKey(x: Byte): Unit

Writes a Byte value as a JSON key.

Writes a Byte value as a JSON key.

Value parameters

x

the Byte value to write

Attributes

def writeKey(x: Char): Unit

Writes a Char value as a JSON key.

Writes a Char value as a JSON key.

Value parameters

x

the Char value to write

Attributes

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.

Value parameters

x

the Short value to write

Attributes

def writeKey(x: Int): Unit

Writes a Int value as a JSON key.

Writes a Int value as a JSON key.

Value parameters

x

the Int value to write

Attributes

def writeKey(x: Long): Unit

Writes a Long value as a JSON key.

Writes a Long value as a JSON key.

Value parameters

x

the Long value to write

Attributes

def writeKey(x: Float): Unit

Writes a Float value as a JSON key.

Writes a Float value as a JSON key.

Value parameters

x

the Float value to write

Attributes

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.

Value parameters

x

the Double value to write

Attributes

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.

Value parameters

x

the BigInt value to write

Attributes

def writeKey(x: BigDecimal): Unit

Writes a BigDecimal value as a JSON key.

Writes a BigDecimal value as a JSON key.

Value parameters

x

the BigDecimal value to write

Attributes

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.

Value parameters

x

the java.util.UUID value to write

Attributes

def writeKey(x: String): Unit

Writes a String value as a JSON key.

Writes a String value as a JSON key.

Value parameters

x

the String value to write

Attributes

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.

Value parameters

x

the java.time.Duration value to write

Attributes

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.

Value parameters

x

the java.time.Duration value to write

Attributes

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.

Value parameters

x

the java.time.LocalDate value to write

Attributes

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.

Value parameters

x

the java.time.LocalDateTime value to write

Attributes

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.

Value parameters

x

the java.time.LocalTime value to write

Attributes

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.

Value parameters

x

the java.time.MonthDay value to write

Attributes

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.

Value parameters

x

the java.time.OffsetDateTime value to write

Attributes

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.

Value parameters

x

the java.time.OffsetTime value to write

Attributes

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.

Value parameters

x

the java.time.Period value to write

Attributes

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.

Value parameters

x

the java.time.Year value to write

Attributes

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.

Value parameters

x

the java.time.YearMonth value to write

Attributes

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.

Value parameters

x

the java.time.ZonedDateTime value to write

Attributes

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.

Value parameters

x

the java.time.ZoneId value to write

Attributes

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.

Value parameters

x

the java.time.ZoneOffset value to write

Attributes

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.

Value parameters

x

the String value to write

Attributes

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.

Value parameters

x

the String value to write

Attributes

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.

Value parameters

bs

the byte array to write

Attributes

def writeVal(x: BigDecimal): Unit

Writes a BigDecimal value as a JSON value.

Writes a BigDecimal value as a JSON value.

Value parameters

x

the BigDecimal value to write

Attributes

def writeVal(x: BigInt): Unit

Writes a BigInt value as a JSON value.

Writes a BigInt value as a JSON value.

Value parameters

x

the BigInt value to write

Attributes

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.

Value parameters

x

the java.util.UUID value to write

Attributes

def writeVal(x: String): Unit

Writes a String value as a JSON value.

Writes a String value as a JSON value.

Value parameters

x

the String value to write

Attributes

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.

Value parameters

x

the java.time.Duration value to write

Attributes

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.

Value parameters

x

the java.time.Instant value to write

Attributes

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.

Value parameters

x

the java.time.LocalDate value to write

Attributes

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.

Value parameters

x

the java.time.LocalDateTime value to write

Attributes

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.

Value parameters

x

the java.time.LocalTime value to write

Attributes

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.

Value parameters

x

the java.time.MonthDay value to write

Attributes

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.

Value parameters

x

the java.time.OffsetDateTime value to write

Attributes

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.

Value parameters

x

the java.time.OffsetTime value to write

Attributes

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.

Value parameters

x

the java.time.Period value to write

Attributes

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.

Value parameters

x

the java.time.Year value to write

Attributes

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.

Value parameters

x

the java.time.YearMonth value to write

Attributes

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.

Value parameters

x

the java.time.ZonedDateTime value to write

Attributes

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.

Value parameters

x

the java.time.ZoneId value to write

Attributes

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.

Value parameters

x

the java.time.ZoneOffset value to write

Attributes

def writeVal(x: Boolean): Unit

Writes a Boolean value as a JSON value.

Writes a Boolean value as a JSON value.

Value parameters

x

the Boolean value to write

Attributes

def writeVal(x: Byte): Unit

Writes a Byte value as a JSON value.

Writes a Byte value as a JSON value.

Value parameters

x

the Byte value to write

Attributes

def writeVal(x: Short): Unit

Writes a Short value as a JSON value.

Writes a Short value as a JSON value.

Value parameters

x

the Short value to write

Attributes

def writeVal(x: Char): Unit

Writes a Char value as a JSON key.

Writes a Char value as a JSON key.

Value parameters

x

the Char value to write

Attributes

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.

Value parameters

x

the Int value to write

Attributes

def writeVal(x: Long): Unit

Writes a Long value as a JSON value.

Writes a Long value as a JSON value.

Value parameters

x

the Long value to write

Attributes

def writeVal(x: Float): Unit

Writes a Float value as a JSON value.

Writes a Float value as a JSON value.

Value parameters

x

the Float value to write

Attributes

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.

Value parameters

x

the Double value to write

Attributes

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.

Value parameters

x

the BigDecimal value to write

Attributes

def writeValAsString(x: BigInt): Unit

Writes a BigInt value as a JSON string value.

Writes a BigInt value as a JSON string value.

Value parameters

x

the BigInt value to write

Attributes

def writeValAsString(x: Boolean): Unit

Writes a Boolean value as a JSON string value.

Writes a Boolean value as a JSON string value.

Value parameters

x

the Boolean value to write

Attributes

def writeValAsString(x: Byte): Unit

Writes a Byte value as a JSON string value.

Writes a Byte value as a JSON string value.

Value parameters

x

the Byte value to write

Attributes

def writeValAsString(x: Short): Unit

Writes a Short value as a JSON string value.

Writes a Short value as a JSON string value.

Value parameters

x

the Short value to write

Attributes

def writeValAsString(x: Int): Unit

Writes a Int value as a JSON string value.

Writes a Int value as a JSON string value.

Value parameters

x

the Int value to write

Attributes

def writeValAsString(x: Long): Unit

Writes a Long value as a JSON string value.

Writes a Long value as a JSON string value.

Value parameters

x

the Long value to write

Attributes

def writeValAsString(x: Float): Unit

Writes a Float value as a JSON string value.

Writes a Float value as a JSON string value.

Value parameters

x

the Float value to write

Attributes

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.

Value parameters

x

the Double value to write

Attributes

Throws
JsonWriterException

if the value is non-finite