BufferStringUtils

cc.otavia.buffer.utils.BufferStringUtils

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object BufferUtils

Members list

Value members

Concrete methods

final def getEscapedChar(index: Int, buffer: Buffer): Char

Get an escaped character at the given index without advancing the readerOffset. Handles backslash escapes and \uXXXX unicode escapes, as well as multi-byte UTF-8 sequences.

Get an escaped character at the given index without advancing the readerOffset. Handles backslash escapes and \uXXXX unicode escapes, as well as multi-byte UTF-8 sequences.

Value parameters

buffer

The buffer to read from.

index

The absolute offset into the buffer.

Attributes

Returns

The decoded character.

final def getStringAsUUID(buffer: Buffer, index: Int): UUID

Parses the string content stored in the buffer as a UUID.

Parses the string content stored in the buffer as a UUID.

Value parameters

buffer

the buffer to read.

index

The read offset, an absolute offset into this buffer, to read from.

Attributes

Returns

The UUID represented by the string content.

final def readEscapedChar(buffer: Buffer): Char

Read an escaped character from the current readerOffset, handling backslash escapes (\n, \t, \", \\) and \uXXXX unicode escapes, as well as multi-byte UTF-8 sequences. Advances the readerOffset past the consumed bytes.

Read an escaped character from the current readerOffset, handling backslash escapes (\n, \t, \", \\) and \uXXXX unicode escapes, as well as multi-byte UTF-8 sequences. Advances the readerOffset past the consumed bytes.

Value parameters

buffer

The buffer to read from.

Attributes

Returns

The decoded character.

final def readEscapedString(buffer: Buffer, len: Int): String

Read an escaped string of the given length from the current readerOffset and translate escape sequences using String.translateEscapes. Advances the readerOffset by len.

Read an escaped string of the given length from the current readerOffset and translate escape sequences using String.translateEscapes. Advances the readerOffset by len.

Value parameters

buffer

The buffer to read from.

len

The number of bytes to read.

Attributes

Returns

The unescaped string.

final def readStringAsUUID(buffer: Buffer): UUID

Parses the string content stored in the buffer as a UUID.

Parses the string content stored in the buffer as a UUID.

Value parameters

buffer

the buffer to read.

Attributes

Returns

The UUID represented by the string content.

final def setUUIDAsString(buffer: Buffer, index: Int, uuid: UUID): Unit

Writes into this buffer, all the bytes from the given uuid string. This not updates the writerOffset of this buffer.

Writes into this buffer, all the bytes from the given uuid string. This not updates the writerOffset of this buffer.

Value parameters

buffer

the buffer to write.

index

The write offset, an absolute offset into this buffer to write to.

uuid

uuid value.

Attributes

final def writeEscapedChar(buffer: Buffer, ch: Char): Unit

Write the given character as an escaped UTF-8 byte sequence at the current writerOffset. Special characters are escaped with backslash (\n, \t, \", \\), control characters are encoded as \uXXXX. Advances the writerOffset by the number of bytes written.

Write the given character as an escaped UTF-8 byte sequence at the current writerOffset. Special characters are escaped with backslash (\n, \t, \", \\), control characters are encoded as \uXXXX. Advances the writerOffset by the number of bytes written.

Value parameters

buffer

The buffer to write to.

ch

The character to write.

Attributes

final def writeEscapedCharWithQuote(buffer: Buffer, ch: Char): Unit

Write the given character as a double-quoted, escaped UTF-8 byte sequence at the current writerOffset. The output format is "ch" with proper escaping. Advances the writerOffset by the number of bytes written.

Write the given character as a double-quoted, escaped UTF-8 byte sequence at the current writerOffset. The output format is "ch" with proper escaping. Advances the writerOffset by the number of bytes written.

Value parameters

buffer

The buffer to write to.

ch

The character to write.

Attributes

final def writeEscapedString(buffer: Buffer, str: String): Unit

Write the given string as an escaped UTF-8 byte sequence at the current writerOffset. Special characters are escaped with backslash. Advances the writerOffset by the number of bytes written.

Write the given string as an escaped UTF-8 byte sequence at the current writerOffset. Special characters are escaped with backslash. Advances the writerOffset by the number of bytes written.

Value parameters

buffer

The buffer to write to.

str

The string to write.

Attributes

final def writeUUIDAsString(buffer: Buffer, uuid: UUID): Unit

Writes into this buffer, all the bytes from the given uuid string. This updates the writerOffset of this buffer.

Writes into this buffer, all the bytes from the given uuid string. This updates the writerOffset of this buffer.

Value parameters

buffer

the buffer to write.

uuid

uuid value.

Attributes

Inherited methods

final protected def byteToChar(b2: Byte): Char

Attributes

Inherited from:
BufferBaseUtils
final protected def digitCount(q0: Long): Int

Attributes

Inherited from:
BufferBaseUtils
final def getStringAsBoolean(buffer: Buffer, index: Int): Boolean

Get a "true" or "false" string at the given index as a Boolean, without advancing the readerOffset.

Get a "true" or "false" string at the given index as a Boolean, without advancing the readerOffset.

Value parameters

buffer

The buffer to read from.

index

The absolute offset into the buffer.

Attributes

Returns

The parsed boolean value.

Inherited from:
BufferBaseUtils
final def isNonEscapedAscii(ch: Char): Boolean

Checks if a character does not require JSON escaping or encoding.

Checks if a character does not require JSON escaping or encoding.

Value parameters

ch

the character to check

Attributes

Returns

true if the character is a basic ASCII character (code point less than 0x80) that does not need JSON escaping

Inherited from:
BufferBaseUtils
final def readStringAsBoolean(buffer: Buffer): Boolean

Parse a "true" or "false" string at the current readerOffset as a Boolean. Advances the readerOffset past the parsed characters.

Parse a "true" or "false" string at the current readerOffset as a Boolean. Advances the readerOffset past the parsed characters.

Value parameters

buffer

The buffer to read from.

Attributes

Returns

The parsed boolean value.

Inherited from:
BufferBaseUtils
final def readStringAsByte(buffer: Buffer): Byte

Parse a variable-length decimal string at the current readerOffset as a Byte. Advances the readerOffset past the parsed digits (and optional leading '-').

Parse a variable-length decimal string at the current readerOffset as a Byte. Advances the readerOffset past the parsed digits (and optional leading '-').

Value parameters

buffer

The buffer to read from.

Attributes

Returns

The parsed byte value.

Throws
NumberFormatException

if the string does not represent a valid byte value.

Inherited from:
BufferBaseUtils
final protected def rop(g: Long, cp: Int): Int

Attributes

Inherited from:
BufferBaseUtils
final protected def rop(g1: Long, g0: Long, cp: Long): Long

Attributes

Inherited from:
BufferBaseUtils
final def setBooleanAsString(buffer: Buffer, index: Int, boolean: Boolean): Unit

Set "true" or "false" at the given index, without modifying the writerOffset.

Set "true" or "false" at the given index, without modifying the writerOffset.

Value parameters

boolean

The boolean value to write.

buffer

The buffer to write to.

index

The absolute offset into the buffer.

Attributes

Inherited from:
BufferBaseUtils
final protected def write18Digits(buffer: Buffer, x: Long, ds: Array[Short]): Unit

Attributes

Inherited from:
BufferBaseUtils
final protected def write2Digits(buffer: Buffer, q0: Int, ds: Array[Short]): Unit

Attributes

Inherited from:
BufferBaseUtils
final protected def write3Digits(buffer: Buffer, q0: Int, ds: Array[Short]): Unit

Attributes

Inherited from:
BufferBaseUtils
final protected def write4Digits(buffer: Buffer, q0: Int, ds: Array[Short]): Unit

Attributes

Inherited from:
BufferBaseUtils
final protected def write8Digits(buffer: Buffer, q0: Long, ds: Array[Short]): Unit

Attributes

Inherited from:
BufferBaseUtils
final def writeBooleanAsString(buffer: Buffer, boolean: Boolean): Unit

Write "true" or "false" at the current writerOffset.

Write "true" or "false" at the current writerOffset.

Value parameters

boolean

The boolean value to write.

buffer

The buffer to write to.

Attributes

Inherited from:
BufferBaseUtils
final def writeByteAsString(buffer: Buffer, byte: Byte): Unit

Write the given Byte as a decimal ASCII string at the current writerOffset.

Write the given Byte as a decimal ASCII string at the current writerOffset.

Value parameters

buffer

The buffer to write to.

byte

The byte value to write.

Attributes

Inherited from:
BufferBaseUtils
final protected def writePositiveIntDigits(q: Int, p: Int, buffer: Buffer, ds: Array[Short]): Unit

Attributes

Inherited from:
BufferBaseUtils