writeByteArray with offset and length

This commit is contained in:
DBotThePony 2024-03-03 16:38:43 +07:00
parent 16666055ba
commit 786dcfbe53
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 7 additions and 1 deletions
gradle.properties
src/main/kotlin/ru/dbotthepony/kommons/io

View File

@ -4,7 +4,7 @@ kotlin.code.style=official
specifyKotlinAsDependency=false
projectGroup=ru.dbotthepony.kommons
projectVersion=2.9.16
projectVersion=2.9.17
guavaDepVersion=33.0.0
gsonDepVersion=2.8.9

View File

@ -316,6 +316,12 @@ fun OutputStream.writeByteArray(value: ByteArray) {
write(value)
}
fun OutputStream.writeByteArray(value: ByteArray, offset: Int, length: Int) {
Objects.checkFromIndexSize(offset, value.size, length)
writeVarInt(length)
write(value, offset, length)
}
fun OutputStream.writeByteKey(key: ByteKey) {
key.write(this)
}