fix envelope formats
This commit is contained in:
parent
2e643287ef
commit
76e7f47528
@ -1,9 +1,9 @@
|
||||
import scientifik.ScientifikExtension
|
||||
|
||||
plugins {
|
||||
id("scientifik.mpp") version "0.2.5" apply false
|
||||
id("scientifik.jvm") version "0.2.5" apply false
|
||||
id("scientifik.publish") version "0.2.5" apply false
|
||||
id("scientifik.mpp") version "0.2.6" apply false
|
||||
id("scientifik.jvm") version "0.2.6" apply false
|
||||
id("scientifik.publish") version "0.2.6" apply false
|
||||
}
|
||||
|
||||
val dataforgeVersion by extra("0.1.5-dev-3")
|
||||
|
@ -9,7 +9,7 @@ scientifik {
|
||||
//withIO()
|
||||
}
|
||||
|
||||
val ioVersion by rootProject.extra("0.2.0-npm-dev-2")
|
||||
val ioVersion by rootProject.extra("0.2.0-npm-dev-3")
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
|
@ -67,7 +67,7 @@ class TaggedEnvelopeFormat(
|
||||
val metaFormat = io.metaFormat(tag.metaFormatKey)
|
||||
?: error("Meta format with key ${tag.metaFormatKey} not found")
|
||||
|
||||
val meta: Meta = limit(tag.metaSize.toInt()).use {
|
||||
val meta: Meta = limit(tag.metaSize.toInt()).run {
|
||||
metaFormat.run {
|
||||
readObject()
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class TaglessEnvelopeFormat(
|
||||
writeProperty(META_LENGTH_PROPERTY, metaBytes.size + 2)
|
||||
writeUtf8String(metaStart + "\r\n")
|
||||
writeBinary(metaBytes)
|
||||
writeUtf8String("\r\n")
|
||||
writeRawString("\r\n")
|
||||
}
|
||||
|
||||
//Printing data
|
||||
@ -71,12 +71,9 @@ class TaglessEnvelopeFormat(
|
||||
val (key, value) = match.destructured
|
||||
properties[key] = value
|
||||
}
|
||||
try {
|
||||
line = readUtf8Line()
|
||||
} catch (ex: EOFException) {
|
||||
//If can't read line, return envelope without data
|
||||
return SimpleEnvelope(Meta.empty, null)
|
||||
}
|
||||
//If can't read line, return envelope without data
|
||||
if (eof()) return SimpleEnvelope(Meta.empty, null)
|
||||
line = readUtf8Line()
|
||||
}
|
||||
|
||||
var meta: Meta = EmptyMeta
|
||||
|
@ -24,7 +24,7 @@ class EnvelopeFormatTest {
|
||||
fun testTaggedFormat(){
|
||||
TaggedEnvelopeFormat.run {
|
||||
val byteArray = this.writeByteArray(envelope)
|
||||
println(byteArray.decodeToString())
|
||||
//println(byteArray.decodeToString())
|
||||
val res = readByteArray(byteArray)
|
||||
assertEquals(envelope.meta,res.meta)
|
||||
val double = res.data?.read {
|
||||
@ -38,7 +38,7 @@ class EnvelopeFormatTest {
|
||||
fun testTaglessFormat(){
|
||||
TaglessEnvelopeFormat.run {
|
||||
val byteArray = writeByteArray(envelope)
|
||||
println(byteArray.decodeToString())
|
||||
//println(byteArray.decodeToString())
|
||||
val res = readByteArray(byteArray)
|
||||
assertEquals(envelope.meta,res.meta)
|
||||
val double = res.data?.read {
|
||||
|
Loading…
Reference in New Issue
Block a user