diff --git a/build.gradle.kts b/build.gradle.kts index 9e432336..969de524 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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") diff --git a/dataforge-io/build.gradle.kts b/dataforge-io/build.gradle.kts index bb27ceff..a8d30c2d 100644 --- a/dataforge-io/build.gradle.kts +++ b/dataforge-io/build.gradle.kts @@ -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 { diff --git a/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaggedEnvelopeFormat.kt b/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaggedEnvelopeFormat.kt index 01888dac..7cea659f 100644 --- a/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaggedEnvelopeFormat.kt +++ b/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaggedEnvelopeFormat.kt @@ -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() } diff --git a/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaglessEnvelopeFormat.kt b/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaglessEnvelopeFormat.kt index a8b72cda..b92e4d44 100644 --- a/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaglessEnvelopeFormat.kt +++ b/dataforge-io/src/commonMain/kotlin/hep/dataforge/io/TaglessEnvelopeFormat.kt @@ -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 diff --git a/dataforge-io/src/commonTest/kotlin/hep/dataforge/io/EnvelopeFormatTest.kt b/dataforge-io/src/commonTest/kotlin/hep/dataforge/io/EnvelopeFormatTest.kt index 0d6782b1..0851d6df 100644 --- a/dataforge-io/src/commonTest/kotlin/hep/dataforge/io/EnvelopeFormatTest.kt +++ b/dataforge-io/src/commonTest/kotlin/hep/dataforge/io/EnvelopeFormatTest.kt @@ -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 {