open class ByteArea : ByteAreaBased, Iterable<Byte>
Represents area inside byte array buffer with specified offset and size.
offset - start index in buffer.
IllegalArgumentException - if offset is negative, size is zero or negative, buffer is empty or area is out of bounds.
Author
Alexander Kornilov (akornilov.82@gmail.com).
<init> |
Constructs new ByteArray with specified size and ByteArea over it. ByteArea(size: Int, offset: Int = 0)
Represents area inside byte array buffer with specified offset and size. ByteArea(buffer: ByteArray, size: Int, offset: Int = 0) |
boundOffset |
The area upper limit. val boundOffset: Int |
buffer |
the source buffer. val buffer: ByteArray |
byteArea |
The object's byte area. open val byteArea: ByteArea |
offset |
start index in buffer. val offset: Int |
size |
the size of byte area. val size: Int |
copyTo |
Copies this area to another area with specified offset within area. fun copyTo(area: ByteArea, offset: Int = 0): ByteArray
Copies this area to buffer with specified offset within buffer. fun copyTo(buffer: ByteArray, offset: Int): ByteArray |
equals |
open fun equals(other: Any?): Boolean |
get |
operator fun get(index: Int): Byte |
hashCode |
open fun hashCode(): Int |
intersection |
Returns intersection between two ByteArea over the same buffer. fun intersection(other: ByteArea): Pair<Int, Int>? |
iterator |
Returns Iterator to goes through bytes of area. open fun iterator(): Iterator<Byte> |
set |
operator fun set(index: Int, value: Byte): Unit |
subarea |
Returns subarea with specified size and offset. fun subarea(size: Int, offset: Int): ByteArea |
crc16 |
Calculates CRC16 of ByteArea from offset with size starting from startValue. fun ByteArea.crc16(startValue: Int = CRC16_START_VALUE, offset: Int = 0, size: Int = this.size - offset): Int |
crc32 |
Calculates CRC32 of ByteArea from offset with size starting from startValue.
If finalize is fun ByteArea.crc32(startValue: Int = CRC32_START_VALUE, finalize: Boolean = true, offset: Int = 0, size: Int = this.size - offset): Int |