0.1.3 release
This commit is contained in:
parent
27c510f5d0
commit
d16d051a1c
@ -29,7 +29,7 @@ class JoinGroupBuilder<T : Any, R : Any>(val actionMeta: Meta) {
|
|||||||
*/
|
*/
|
||||||
fun byValue(tag: String, defaultTag: String = "@default", action: JoinGroup<T, R>.() -> Unit) {
|
fun byValue(tag: String, defaultTag: String = "@default", action: JoinGroup<T, R>.() -> Unit) {
|
||||||
groupRules += { node ->
|
groupRules += { node ->
|
||||||
GroupBuilder.byValue(tag, defaultTag).invoke(node).map {
|
GroupRule.byValue(tag, defaultTag).invoke(node).map {
|
||||||
JoinGroup<T, R>(it.key, it.value).apply(action)
|
JoinGroup<T, R>(it.key, it.value).apply(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ interface Binary {
|
|||||||
/**
|
/**
|
||||||
* A [Binary] with addition random access functionality. It by default allows multiple [read] operations.
|
* A [Binary] with addition random access functionality. It by default allows multiple [read] operations.
|
||||||
*/
|
*/
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
interface RandomAccessBinary : Binary {
|
interface RandomAccessBinary : Binary {
|
||||||
/**
|
/**
|
||||||
* Read at most [size] of bytes starting at [from] offset from the beginning of the binary.
|
* Read at most [size] of bytes starting at [from] offset from the beginning of the binary.
|
||||||
@ -39,10 +40,12 @@ fun Binary.readAll(): ByteReadPacket = read {
|
|||||||
ByteReadPacket(this.readBytes())
|
ByteReadPacket(this.readBytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
fun RandomAccessBinary.readPacket(from: UInt, size: UInt): ByteReadPacket = read(from, size) {
|
fun RandomAccessBinary.readPacket(from: UInt, size: UInt): ByteReadPacket = read(from, size) {
|
||||||
ByteReadPacket(this.readBytes())
|
ByteReadPacket(this.readBytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
object EmptyBinary : RandomAccessBinary {
|
object EmptyBinary : RandomAccessBinary {
|
||||||
|
|
||||||
override val size: ULong = 0.toULong()
|
override val size: ULong = 0.toULong()
|
||||||
@ -52,6 +55,7 @@ object EmptyBinary : RandomAccessBinary {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
class ArrayBinary(val array: ByteArray) : RandomAccessBinary {
|
class ArrayBinary(val array: ByteArray) : RandomAccessBinary {
|
||||||
override val size: ULong get() = array.size.toULong()
|
override val size: ULong get() = array.size.toULong()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user