Encapsulate implementations.

This commit is contained in:
Alexander Nozik 2021-01-28 12:34:04 +03:00
parent 62d33ddacd
commit 5829c12372
3 changed files with 5 additions and 13 deletions

View File

@ -36,7 +36,7 @@ public class NumassDirectorySet internal constructor(
it.fileName.name.startsWith("p")
}.map { pointPath ->
try {
context.readNumassFile(pointPath)
context.readNumassPointFile(pointPath)
} catch (e: Exception) {
context.logger.error(e) { "Error reading Numass point file $pointPath" }
null
@ -46,12 +46,12 @@ public class NumassDirectorySet internal constructor(
}
@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")
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)
public fun Context.readNumassDirectory(path: Path): NumassDirectorySet {

View File

@ -35,7 +35,7 @@ import java.util.zip.Inflater
* Protobuf based numass point
* Created by Alexander Nozik on 09.07.2017.
*/
public class ProtoNumassPoint(
internal class ProtoNumassPoint(
override val meta: Meta,
private val protoBuilder: () -> Point,
) : NumassPoint {

View File

@ -28,15 +28,7 @@ import kotlinx.io.*
import java.util.*
/**
* 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")
internal class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeFormat {
private fun Tag.toBinary() = Binary(24) {
writeRawString(START_SEQUENCE)