WriterConfig

class WriterConfig extends Serializable

Configuration for com.github.plokhotnyuk.jsoniter_scala.core.JsonWriter that contains params for formatting of output JSON and for tuning of preferred size for internal byte buffer that is created on the writer instantiation and reused in runtime for serialization of messages using java.io.OutputStream or java.nio.DirectByteBuffer.
All configuration params already initialized to default values, but in some cases they should be altered:

  • turn on pretty printing by specifying of indention step that is greater than 0

  • turn on escaping of Unicode characters to serialize with only ASCII characters

  • increase preferred size of an internal byte buffer to reduce allocation rate of grown and then reduced buffers when writing to java.io.OutputStream or java.nio.DirectByteBuffer lot of large (>16Kb) scala.math.BigDecimal, scala.math.BigInt or other non escaped ASCII strings written using JsonWriter.writeNonEscapedAsciiKey or JsonWriter.writeNonEscapedAsciiVal

Value parameters:
escapeUnicode

a flag to turn on hexadecimal escaping of all non-ASCII chars

indentionStep

a size of indention for pretty-printed formatting or 0 for compact output

preferredBufSize

a preferred size (in bytes) of an internal byte buffer when writing to java.io.OutputStream or java.nio.DirectByteBuffer

throwWriterExceptionWithStackTrace

a flag that allows to turn on a stack traces for debugging purposes in development

Companion:
object
trait Serializable
class Object
trait Matchable
class Any
object WriterConfig.type

Value members

Concrete methods

def withEscapeUnicode(escapeUnicode: Boolean): WriterConfig
def withIndentionStep(indentionStep: Int): WriterConfig
def withPreferredBufSize(preferredBufSize: Int): WriterConfig
def withThrowWriterExceptionWithStackTrace(throwWriterExceptionWithStackTrace: Boolean): WriterConfig

Concrete fields

val escapeUnicode: Boolean
val indentionStep: Int