Add docs to writeByteArray

This commit is contained in:
DBotThePony 2024-03-03 16:42:13 +07:00
parent 786dcfbe53
commit e189009494
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -311,11 +311,17 @@ fun <S : OutputStream, V : Any> S.writeOptional(value: Optional<V>, writer: S.(V
}
}
/**
* Writes array's size as variable length integer and then writes its contents
*/
fun OutputStream.writeByteArray(value: ByteArray) {
writeVarInt(value.size)
write(value)
}
/**
* Writes array's size as variable length integer and then writes its contents
*/
fun OutputStream.writeByteArray(value: ByteArray, offset: Int, length: Int) {
Objects.checkFromIndexSize(offset, value.size, length)
writeVarInt(length)