Removed unnecessary non-null
This commit is contained in:
parent
b9dafe4c1d
commit
9967f5294d
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2010 dorkbox, llc
|
||||
* Copyright 2023 dorkbox, llc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -12,7 +12,9 @@
|
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, Nathan Sweet
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -76,7 +78,7 @@ class ByteBufOutput : Output {
|
|||
|
||||
/** Returns the buffer. The bytes between zero and [.position] are the data that has been written. */
|
||||
// NOTE: capacity IS NOT USED!
|
||||
var byteBuf: ByteBuf? = null
|
||||
lateinit var byteBuf: ByteBuf
|
||||
private set
|
||||
|
||||
private var initialReaderIndex = 0
|
||||
|
@ -189,19 +191,19 @@ class ByteBufOutput : Output {
|
|||
|
||||
override fun toBytes(): ByteArray {
|
||||
val newBuffer = ByteArray(position)
|
||||
byteBuf!!.readerIndex(initialReaderIndex)
|
||||
byteBuf!!.getBytes(initialReaderIndex, newBuffer, 0, position)
|
||||
byteBuf.readerIndex(initialReaderIndex)
|
||||
byteBuf.getBytes(initialReaderIndex, newBuffer, 0, position)
|
||||
return newBuffer
|
||||
}
|
||||
|
||||
override fun setPosition(position: Int) {
|
||||
this.position = position
|
||||
byteBuf!!.writerIndex(position)
|
||||
byteBuf.writerIndex(position)
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
super.reset()
|
||||
byteBuf!!.setIndex(initialReaderIndex, initialWriterIndex)
|
||||
byteBuf.setIndex(initialReaderIndex, initialWriterIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,10 +212,10 @@ class ByteBufOutput : Output {
|
|||
*/
|
||||
@Throws(KryoException::class)
|
||||
override fun require(required: Int): Boolean {
|
||||
if (byteBuf!!.isWritable(required)) {
|
||||
if (byteBuf.isWritable(required)) {
|
||||
return false
|
||||
}
|
||||
var origCode = byteBuf!!.ensureWritable(required, true)
|
||||
var origCode = byteBuf.ensureWritable(required, true)
|
||||
if (origCode == 0) {
|
||||
// 0 if the buffer has enough writable bytes, and its capacity is unchanged.
|
||||
return false
|
||||
|
@ -229,7 +231,7 @@ class ByteBufOutput : Output {
|
|||
}
|
||||
|
||||
// only got here because we were unable to resize the buffer! So we flushed it first to try again!
|
||||
origCode = byteBuf!!.ensureWritable(required, true)
|
||||
origCode = byteBuf.ensureWritable(required, true)
|
||||
return if (origCode == 0) {
|
||||
// 0 if the buffer has enough writable bytes, and its capacity is unchanged.
|
||||
false
|
||||
|
@ -253,8 +255,8 @@ class ByteBufOutput : Output {
|
|||
if (outputStream == null) return
|
||||
try {
|
||||
val tmp = ByteArray(position)
|
||||
byteBuf!!.getBytes(initialReaderIndex, tmp)
|
||||
byteBuf!!.readerIndex(initialReaderIndex)
|
||||
byteBuf.getBytes(initialReaderIndex, tmp)
|
||||
byteBuf.readerIndex(initialReaderIndex)
|
||||
outputStream.write(tmp, 0, position)
|
||||
} catch (ex: IOException) {
|
||||
throw KryoException(ex)
|
||||
|
@ -277,7 +279,7 @@ class ByteBufOutput : Output {
|
|||
@Throws(KryoException::class)
|
||||
override fun write(value: Int) {
|
||||
require(1)
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
position++
|
||||
}
|
||||
|
||||
|
@ -296,14 +298,14 @@ class ByteBufOutput : Output {
|
|||
@Throws(KryoException::class)
|
||||
override fun writeByte(value: Byte) {
|
||||
require(1)
|
||||
byteBuf!!.writeByte(value.toInt())
|
||||
byteBuf.writeByte(value.toInt())
|
||||
position++
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
override fun writeByte(value: Int) {
|
||||
require(1)
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
position++
|
||||
}
|
||||
|
||||
|
@ -317,7 +319,7 @@ class ByteBufOutput : Output {
|
|||
override fun writeBytes(bytes: ByteArray, offset: Int, count: Int) {
|
||||
requireNotNull(bytes) { "bytes cannot be null." }
|
||||
require(count)
|
||||
byteBuf!!.writeBytes(bytes, offset, count)
|
||||
byteBuf.writeBytes(bytes, offset, count)
|
||||
position += count
|
||||
}
|
||||
|
||||
|
@ -326,7 +328,7 @@ class ByteBufOutput : Output {
|
|||
override fun writeInt(value: Int) {
|
||||
require(4)
|
||||
position += 4
|
||||
byteBuf!!.writeInt(value)
|
||||
byteBuf.writeInt(value)
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -337,21 +339,21 @@ class ByteBufOutput : Output {
|
|||
if (value ushr 7 == 0) {
|
||||
require(1)
|
||||
position++
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
return 1
|
||||
}
|
||||
if (value ushr 14 == 0) {
|
||||
require(2)
|
||||
position += 2
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf!!.writeByte((value ushr 7).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7).toByte().toInt())
|
||||
return 2
|
||||
}
|
||||
if (value ushr 21 == 0) {
|
||||
require(3)
|
||||
position += 3
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14).toByte().toInt())
|
||||
return 3
|
||||
|
@ -360,7 +362,7 @@ class ByteBufOutput : Output {
|
|||
require(4)
|
||||
position += 4
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21).toByte().toInt())
|
||||
|
@ -369,7 +371,7 @@ class ByteBufOutput : Output {
|
|||
require(5)
|
||||
position += 5
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21 or 0x80).toByte().toInt())
|
||||
|
@ -384,22 +386,22 @@ class ByteBufOutput : Output {
|
|||
val first = value and 0x3F or if (flag) 0x80 else 0 // Mask first 6 bits, bit 8 is the flag.
|
||||
if (value ushr 6 == 0) {
|
||||
require(1)
|
||||
byteBuf!!.writeByte(first.toByte().toInt())
|
||||
byteBuf.writeByte(first.toByte().toInt())
|
||||
position++
|
||||
return 1
|
||||
}
|
||||
if (value ushr 13 == 0) {
|
||||
require(2)
|
||||
position += 2
|
||||
byteBuf!!.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf!!.writeByte((value ushr 6).toByte().toInt())
|
||||
byteBuf.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf.writeByte((value ushr 6).toByte().toInt())
|
||||
return 2
|
||||
}
|
||||
if (value ushr 20 == 0) {
|
||||
require(3)
|
||||
position += 3
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf.writeByte((value ushr 6 or 0x80).toByte().toInt()) // Set bit 8.
|
||||
byteBuf.writeByte((value ushr 13).toByte().toInt())
|
||||
return 3
|
||||
|
@ -408,7 +410,7 @@ class ByteBufOutput : Output {
|
|||
require(4)
|
||||
position += 4
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf.writeByte((value ushr 6 or 0x80).toByte().toInt()) // Set bit 8.
|
||||
byteBuf.writeByte((value ushr 13 or 0x80).toByte().toInt()) // Set bit 8.
|
||||
byteBuf.writeByte((value ushr 20).toByte().toInt())
|
||||
|
@ -417,7 +419,7 @@ class ByteBufOutput : Output {
|
|||
require(5)
|
||||
position += 5
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf.writeByte((first or 0x40).toByte().toInt()) // Set bit 7.
|
||||
byteBuf.writeByte((value ushr 6 or 0x80).toByte().toInt()) // Set bit 8.
|
||||
byteBuf.writeByte((value ushr 13 or 0x80).toByte().toInt()) // Set bit 8.
|
||||
byteBuf.writeByte((value ushr 20 or 0x80).toByte().toInt()) // Set bit 8.
|
||||
|
@ -430,7 +432,7 @@ class ByteBufOutput : Output {
|
|||
override fun writeLong(value: Long) {
|
||||
require(8)
|
||||
position += 8
|
||||
byteBuf!!.writeLong(value)
|
||||
byteBuf.writeLong(value)
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -440,21 +442,21 @@ class ByteBufOutput : Output {
|
|||
if (value ushr 7 == 0L) {
|
||||
require(1)
|
||||
position++
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
return 1
|
||||
}
|
||||
if (value ushr 14 == 0L) {
|
||||
require(2)
|
||||
position += 2
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf!!.writeByte((value ushr 7).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7).toByte().toInt())
|
||||
return 2
|
||||
}
|
||||
if (value ushr 21 == 0L) {
|
||||
require(3)
|
||||
position += 3
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14).toByte().toInt())
|
||||
return 3
|
||||
|
@ -463,7 +465,7 @@ class ByteBufOutput : Output {
|
|||
require(4)
|
||||
position += 4
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21).toByte().toInt())
|
||||
|
@ -473,7 +475,7 @@ class ByteBufOutput : Output {
|
|||
require(5)
|
||||
position += 5
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21 or 0x80).toByte().toInt())
|
||||
|
@ -484,7 +486,7 @@ class ByteBufOutput : Output {
|
|||
require(6)
|
||||
position += 6
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21 or 0x80).toByte().toInt())
|
||||
|
@ -496,7 +498,7 @@ class ByteBufOutput : Output {
|
|||
require(7)
|
||||
position += 7
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21 or 0x80).toByte().toInt())
|
||||
|
@ -509,7 +511,7 @@ class ByteBufOutput : Output {
|
|||
require(8)
|
||||
position += 8
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21 or 0x80).toByte().toInt())
|
||||
|
@ -522,7 +524,7 @@ class ByteBufOutput : Output {
|
|||
require(9)
|
||||
position += 9
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value and 0x7F or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 7 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 14 or 0x80).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 21 or 0x80).toByte().toInt())
|
||||
|
@ -540,7 +542,7 @@ class ByteBufOutput : Output {
|
|||
require(4)
|
||||
val byteBuf = byteBuf
|
||||
position += 4
|
||||
byteBuf!!.writeFloat(value)
|
||||
byteBuf.writeFloat(value)
|
||||
}
|
||||
|
||||
// double:
|
||||
|
@ -549,7 +551,7 @@ class ByteBufOutput : Output {
|
|||
require(8)
|
||||
position += 8
|
||||
val byteBuf = byteBuf
|
||||
byteBuf!!.writeDouble(value)
|
||||
byteBuf.writeDouble(value)
|
||||
}
|
||||
|
||||
// short:
|
||||
|
@ -557,7 +559,7 @@ class ByteBufOutput : Output {
|
|||
override fun writeShort(value: Int) {
|
||||
require(2)
|
||||
position += 2
|
||||
byteBuf!!.writeShort(value)
|
||||
byteBuf.writeShort(value)
|
||||
}
|
||||
|
||||
// char:
|
||||
|
@ -565,14 +567,14 @@ class ByteBufOutput : Output {
|
|||
override fun writeChar(value: Char) {
|
||||
require(2)
|
||||
position += 2
|
||||
byteBuf!!.writeChar(value.code)
|
||||
byteBuf.writeChar(value.code)
|
||||
}
|
||||
|
||||
// boolean:
|
||||
@Throws(KryoException::class)
|
||||
override fun writeBoolean(value: Boolean) {
|
||||
require(1)
|
||||
byteBuf!!.writeByte((if (value) 1 else 0).toByte().toInt())
|
||||
byteBuf.writeByte((if (value) 1 else 0).toByte().toInt())
|
||||
position++
|
||||
}
|
||||
|
||||
|
@ -608,14 +610,14 @@ class ByteBufOutput : Output {
|
|||
var i = 0
|
||||
val n = value.length
|
||||
while (i < n) {
|
||||
byteBuf!!.writeByte(value[i].code.toByte().toInt())
|
||||
byteBuf.writeByte(value[i].code.toByte().toInt())
|
||||
++i
|
||||
}
|
||||
position += charCount
|
||||
|
||||
// mod the last written byte with 0x80 so we can use that when reading ascii bytes to see what the end of the string is
|
||||
val value1: Byte = (byteBuf!!.getByte(position - 1).toInt() or 0x80).toByte()
|
||||
byteBuf!!.setByte(position - 1, value1.toInt())
|
||||
val value1: Byte = (byteBuf.getByte(position - 1).toInt() or 0x80).toByte()
|
||||
byteBuf.setByte(position - 1, value1.toInt())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -624,7 +626,7 @@ class ByteBufOutput : Output {
|
|||
writeVarIntFlag(true, charCount + 1, true)
|
||||
var charIndex = 0
|
||||
// Try to write 7 bit chars.
|
||||
val byteBuf = byteBuf!!
|
||||
val byteBuf = byteBuf
|
||||
while (true) {
|
||||
val c = value[charIndex].code
|
||||
if (c > 127) break
|
||||
|
@ -655,11 +657,11 @@ class ByteBufOutput : Output {
|
|||
var i = 0
|
||||
val n = value.length
|
||||
while (i < n) {
|
||||
byteBuf!!.writeByte(value[i].code.toByte().toInt())
|
||||
byteBuf.writeByte(value[i].code.toByte().toInt())
|
||||
++i
|
||||
}
|
||||
position += charCount
|
||||
byteBuf!!.setByte(position - 1, (byteBuf.getByte(position - 1).toInt() or 0x80).toByte().toInt()) // Bit 8 means end of ASCII.
|
||||
byteBuf.setByte(position - 1, (byteBuf.getByte(position - 1).toInt() or 0x80).toByte().toInt()) // Bit 8 means end of ASCII.
|
||||
}
|
||||
|
||||
private fun writeUtf8_slow(value: String, charCount: Int, charIndex: Int) {
|
||||
|
@ -672,14 +674,14 @@ class ByteBufOutput : Output {
|
|||
writeByte(c.toByte())
|
||||
} else if (c > 0x07FF) {
|
||||
require(3)
|
||||
byteBuf!!.writeByte((0xE0 or (c shr 12 and 0x0F)).toByte().toInt())
|
||||
byteBuf!!.writeByte((0x80 or (c shr 6 and 0x3F)).toByte().toInt())
|
||||
byteBuf!!.writeByte((0x80 or (c and 0x3F)).toByte().toInt())
|
||||
byteBuf.writeByte((0xE0 or (c shr 12 and 0x0F)).toByte().toInt())
|
||||
byteBuf.writeByte((0x80 or (c shr 6 and 0x3F)).toByte().toInt())
|
||||
byteBuf.writeByte((0x80 or (c and 0x3F)).toByte().toInt())
|
||||
position += 3
|
||||
} else {
|
||||
require(2)
|
||||
byteBuf!!.writeByte((0xC0 or (c shr 6 and 0x1F)).toByte().toInt())
|
||||
byteBuf!!.writeByte((0x80 or (c and 0x3F)).toByte().toInt())
|
||||
byteBuf.writeByte((0xC0 or (c shr 6 and 0x1F)).toByte().toInt())
|
||||
byteBuf.writeByte((0x80 or (c and 0x3F)).toByte().toInt())
|
||||
position += 2
|
||||
}
|
||||
charIndex++
|
||||
|
@ -695,13 +697,13 @@ class ByteBufOutput : Output {
|
|||
val n = offset + count
|
||||
while (offset < n) {
|
||||
val value = array[offset]
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte((value shr 8).toByte().toInt())
|
||||
byteBuf.writeByte((value shr 16).toByte().toInt())
|
||||
byteBuf.writeByte((value shr 24).toByte().toInt())
|
||||
offset++
|
||||
}
|
||||
position = byteBuf!!.writerIndex()
|
||||
position = byteBuf.writerIndex()
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -712,7 +714,7 @@ class ByteBufOutput : Output {
|
|||
val n = offset + count
|
||||
while (offset < n) {
|
||||
val value = array[offset]
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 8).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 16).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 24).toByte().toInt())
|
||||
|
@ -722,7 +724,7 @@ class ByteBufOutput : Output {
|
|||
byteBuf.writeByte((value ushr 56).toByte().toInt())
|
||||
offset++
|
||||
}
|
||||
position = byteBuf!!.writerIndex()
|
||||
position = byteBuf.writerIndex()
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -733,13 +735,13 @@ class ByteBufOutput : Output {
|
|||
val n = offset + count
|
||||
while (offset < n) {
|
||||
val value = java.lang.Float.floatToIntBits(array[offset])
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte((value shr 8).toByte().toInt())
|
||||
byteBuf.writeByte((value shr 16).toByte().toInt())
|
||||
byteBuf.writeByte((value shr 24).toByte().toInt())
|
||||
offset++
|
||||
}
|
||||
position = byteBuf!!.writerIndex()
|
||||
position = byteBuf.writerIndex()
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -750,7 +752,7 @@ class ByteBufOutput : Output {
|
|||
val n = offset + count
|
||||
while (offset < n) {
|
||||
val value = java.lang.Double.doubleToLongBits(array[offset])
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 8).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 16).toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 24).toByte().toInt())
|
||||
|
@ -760,7 +762,7 @@ class ByteBufOutput : Output {
|
|||
byteBuf.writeByte((value ushr 56).toByte().toInt())
|
||||
offset++
|
||||
}
|
||||
position = byteBuf!!.writerIndex()
|
||||
position = byteBuf.writerIndex()
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -770,11 +772,11 @@ class ByteBufOutput : Output {
|
|||
val n = offset + count
|
||||
while (offset < n) {
|
||||
val value = array[offset].toInt()
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf!!.writeByte((value ushr 8).toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 8).toByte().toInt())
|
||||
offset++
|
||||
}
|
||||
position = byteBuf!!.writerIndex()
|
||||
position = byteBuf.writerIndex()
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -784,11 +786,11 @@ class ByteBufOutput : Output {
|
|||
val n = offset + count
|
||||
while (offset < n) {
|
||||
val value = array[offset].toInt()
|
||||
byteBuf!!.writeByte(value.toByte().toInt())
|
||||
byteBuf!!.writeByte((value ushr 8).toByte().toInt())
|
||||
byteBuf.writeByte(value.toByte().toInt())
|
||||
byteBuf.writeByte((value ushr 8).toByte().toInt())
|
||||
offset++
|
||||
}
|
||||
position = byteBuf!!.writerIndex()
|
||||
position = byteBuf.writerIndex()
|
||||
}
|
||||
|
||||
@Throws(KryoException::class)
|
||||
|
@ -797,9 +799,9 @@ class ByteBufOutput : Output {
|
|||
require(count)
|
||||
val n = offset + count
|
||||
while (offset < n) {
|
||||
byteBuf!!.writeByte(if (array[offset]) 1 else 0)
|
||||
byteBuf.writeByte(if (array[offset]) 1 else 0)
|
||||
offset++
|
||||
}
|
||||
position = byteBuf!!.writerIndex()
|
||||
position = byteBuf.writerIndex()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue