PgByteWriter

class PgByteWriter(initialCapacity: Int = 1024, maxCapacity: Int = 65536)

Optimized buffer for building binary packets for the database. Allows reserving space for size and filling it later without memory copying.

Constructors

Link copied to clipboard
constructor(initialCapacity: Int = 1024, maxCapacity: Int = 65536)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun clear()
Link copied to clipboard
fun fillLengthInt(markerIndex: Int)

Calculates the number of bytes added since reserveLengthInt was called and writes this value at the marker. Does not include the 4 bytes of the marker itself (in accordance with many PG structures).

Link copied to clipboard

Leaves 4 bytes of space for a number (e.g. packet size) and returns the index where this size should be written later.

Link copied to clipboard
Link copied to clipboard
fun updatePosition(newPosition: Int)
Link copied to clipboard
fun writeByte(b: Byte)
Link copied to clipboard
fun writeBytes(bytes: ByteArray)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun writeInt(i: Int)
Link copied to clipboard
fun writeLong(l: Long)
Link copied to clipboard