Skip to content

Commit

Permalink
0.1.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Aug 17, 2019
1 parent 27c510f commit d16d051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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)
}
}
Expand Down
4 changes: 4 additions & 0 deletions dataforge-io/src/commonMain/kotlin/hep/dataforge/io/Binary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface Binary {
/**
* A [Binary] with addition random access functionality. It by default allows multiple [read] operations.
*/
@ExperimentalUnsignedTypes
interface RandomAccessBinary : Binary {
/**
* Read at most [size] of bytes starting at [from] offset from the beginning of the binary.
Expand All @@ -39,10 +40,12 @@ fun Binary.readAll(): ByteReadPacket = read {
ByteReadPacket(this.readBytes())
}

@ExperimentalUnsignedTypes
fun RandomAccessBinary.readPacket(from: UInt, size: UInt): ByteReadPacket = read(from, size) {
ByteReadPacket(this.readBytes())
}

@ExperimentalUnsignedTypes
object EmptyBinary : RandomAccessBinary {

override val size: ULong = 0.toULong()
Expand All @@ -52,6 +55,7 @@ object EmptyBinary : RandomAccessBinary {
}
}

@ExperimentalUnsignedTypes
class ArrayBinary(val array: ByteArray) : RandomAccessBinary {
override val size: ULong get() = array.size.toULong()

Expand Down

0 comments on commit d16d051

Please sign in to comment.