Encapsulate implementations.
This commit is contained in:
parent
62d33ddacd
commit
5829c12372
@ -36,7 +36,7 @@ public class NumassDirectorySet internal constructor(
|
|||||||
it.fileName.name.startsWith("p")
|
it.fileName.name.startsWith("p")
|
||||||
}.map { pointPath ->
|
}.map { pointPath ->
|
||||||
try {
|
try {
|
||||||
context.readNumassFile(pointPath)
|
context.readNumassPointFile(pointPath)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
context.logger.error(e) { "Error reading Numass point file $pointPath" }
|
context.logger.error(e) { "Error reading Numass point file $pointPath" }
|
||||||
null
|
null
|
||||||
@ -46,12 +46,12 @@ public class NumassDirectorySet internal constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(DFExperimental::class)
|
@OptIn(DFExperimental::class)
|
||||||
public fun Context.readNumassFile(path: Path): ProtoNumassPoint? {
|
public fun Context.readNumassPointFile(path: Path): NumassPoint? {
|
||||||
val envelope = io.readEnvelopeFile(path) ?: error("Envelope could not be read from $path")
|
val envelope = io.readEnvelopeFile(path) ?: error("Envelope could not be read from $path")
|
||||||
return ProtoNumassPoint.fromEnvelope(envelope)
|
return ProtoNumassPoint.fromEnvelope(envelope)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun Context.readNumassFile(path: String): ProtoNumassPoint? = readNumassFile(Path.of(path))
|
public fun Context.readNumassPointFile(path: String): NumassPoint? = readNumassPointFile(Path.of(path))
|
||||||
|
|
||||||
@OptIn(ExperimentalPathApi::class)
|
@OptIn(ExperimentalPathApi::class)
|
||||||
public fun Context.readNumassDirectory(path: Path): NumassDirectorySet {
|
public fun Context.readNumassDirectory(path: Path): NumassDirectorySet {
|
||||||
|
@ -35,7 +35,7 @@ import java.util.zip.Inflater
|
|||||||
* Protobuf based numass point
|
* Protobuf based numass point
|
||||||
* Created by Alexander Nozik on 09.07.2017.
|
* Created by Alexander Nozik on 09.07.2017.
|
||||||
*/
|
*/
|
||||||
public class ProtoNumassPoint(
|
internal class ProtoNumassPoint(
|
||||||
override val meta: Meta,
|
override val meta: Meta,
|
||||||
private val protoBuilder: () -> Point,
|
private val protoBuilder: () -> Point,
|
||||||
) : NumassPoint {
|
) : NumassPoint {
|
||||||
|
@ -28,15 +28,7 @@ import kotlinx.io.*
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
/**
|
internal class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeFormat {
|
||||||
* A streaming-friendly envelope format with a short binary tag.
|
|
||||||
* TODO add description
|
|
||||||
*/
|
|
||||||
public class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeFormat {
|
|
||||||
|
|
||||||
// private val metaFormat = io.metaFormat(metaFormatKey)
|
|
||||||
// ?: error("Meta format with key $metaFormatKey could not be resolved in $io")
|
|
||||||
|
|
||||||
|
|
||||||
private fun Tag.toBinary() = Binary(24) {
|
private fun Tag.toBinary() = Binary(24) {
|
||||||
writeRawString(START_SEQUENCE)
|
writeRawString(START_SEQUENCE)
|
||||||
|
Loading…
Reference in New Issue
Block a user