ByteArrayDataOutput

DataOutput backed by a byte array. WARNING: This class omits most low-level checks, so be sure to test heavily with assertions enabled.

Constructors

Link copied to clipboard
constructor(bytes: ByteArray)
constructor(bytes: ByteArray, offset: Int, len: Int)
constructor()

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open fun copyBytes(input: DataInput, numBytes: Long)

Copy numBytes bytes from input to ourself.

Link copied to clipboard
fun reset(bytes: ByteArray, offset: Int = 0, len: Int = bytes.size)
Link copied to clipboard
open override fun writeByte(b: Byte)

Writes a single byte.

Link copied to clipboard
open override fun writeBytes(b: ByteArray, offset: Int, length: Int)
open fun writeBytes(b: ByteArray, length: Int)

Writes an array of bytes.

Link copied to clipboard
fun writeGroupVInts(values: IntArray, limit: Int)

Encode integers using group-varint. It uses VInt to encode tail values that are not enough for a group.

fun writeGroupVInts(values: LongArray, limit: Int)

Encode integers using group-varint. It uses VInt to encode tail values that are not enough for a group. we need a long[] because this is what postings are using, all longs are actually required to be integers.

Link copied to clipboard
open override fun writeInt(i: Int)

Writes an int as four bytes (LE byte order).

Link copied to clipboard
open override fun writeLong(i: Long)

Writes a long as eight bytes (LE byte order).

Link copied to clipboard

Writes a String map.

Link copied to clipboard

Writes a String set.

Link copied to clipboard
open override fun writeShort(i: Short)

Writes a short as two bytes (LE byte order).

Link copied to clipboard
open fun writeString(s: String)

Writes a string.

Link copied to clipboard
fun writeVInt(i: Int)

Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are supported, but should be avoided.

Link copied to clipboard

Writes an long in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Link copied to clipboard
fun writeZInt(i: Int)

Write a zig-zag-encoded .writeVInt integer. This is typically useful to write small signed ints and is equivalent to calling writeVInt(BitUtil.zigZagEncode(i)).

Link copied to clipboard

Write a zig-zag-encoded .writeVLong long. Writes between one and ten bytes. This is typically useful to write small signed ints.