IOPlugin

class IOPlugin(meta: Meta) : AbstractPlugin

Types

Companion
Link copied to clipboard
common
object Companion : PluginFactory<IOPlugin>

Functions

attach
Link copied to clipboard
common
open override fun attach(context: Context)
content
Link copied to clipboard
common
open override fun content(target: String): Map<Name, Any>
dependsOn
Link copied to clipboard
common
override fun dependsOn(): Map<PluginFactory<*>, Meta>
detach
Link copied to clipboard
common
open override fun detach()
resolveEnvelopeFormat
Link copied to clipboard
common
fun resolveEnvelopeFormat(item: Meta): EnvelopeFormat?
resolveIOFormat
Link copied to clipboard
common
fun <T : Any> resolveIOFormat(item: Meta, type: KClass<out T>): IOFormat<T>?
resolveMetaFormat
Link copied to clipboard
common
fun resolveMetaFormat(key: Short, meta: Meta = Meta.EMPTY): MetaFormat?
fun resolveMetaFormat(name: String, meta: Meta = Meta.EMPTY): MetaFormat?
toMeta
Link copied to clipboard
common
open override fun toMeta(): Meta

Properties

context
Link copied to clipboard
common
open override val context: Context
defaultChainTarget
Link copied to clipboard
common
open val defaultChainTarget: String
defaultTarget
Link copied to clipboard
common
open val defaultTarget: String
envelopeFormatFactories
Link copied to clipboard
common
ioFormatFactories
Link copied to clipboard
common
val ioFormatFactories: Collection<IOFormatFactory<*>>
meta
Link copied to clipboard
common
open override val meta: Meta
metaFormatFactories
Link copied to clipboard
common
val metaFormatFactories: Collection<MetaFormatFactory>
name
Link copied to clipboard
common
open override val name: Name
tag
Link copied to clipboard
common
open override val tag: PluginTag

Extensions

peekFileEnvelopeFormat
Link copied to clipboard
fun IOPlugin.peekFileEnvelopeFormat(path: Path): EnvelopeFormat?

Return inferred EnvelopeFormat if only one format could read given file. If no format accepts file, return null. If multiple formats accepts file, throw an error.

readEnvelopeFile
Link copied to clipboard
fun IOPlugin.readEnvelopeFile(path: Path, readNonEnvelopes: Boolean = false, formatPicker: IOPlugin.(Path) -> EnvelopeFormat? = IOPlugin::peekFileEnvelopeFormat): Envelope

Read and envelope from file if the file exists, return null if file does not exist.

readMetaFile
Link copied to clipboard
fun IOPlugin.readMetaFile(path: Path, formatOverride: MetaFormat? = null, descriptor: MetaDescriptor? = null): Meta

Read file containing meta using given formatOverride or file extension to infer meta type. If path is a directory search for file starting with meta in it

resolveIOFormat
Link copied to clipboard
inline fun <T : Any> IOPlugin.resolveIOFormat(): IOFormat<T>?

Resolve IOFormat based on type

writeEnvelopeDirectory
Link copied to clipboard
fun IOPlugin.writeEnvelopeDirectory(path: Path, envelope: Envelope, metaFormat: MetaFormatFactory = JsonMetaFormat)

Write separate meta and data files to given directory path

writeEnvelopeFile
Link copied to clipboard
fun IOPlugin.writeEnvelopeFile(path: Path, envelope: Envelope, envelopeFormat: EnvelopeFormat = TaggedEnvelopeFormat, metaFormat: MetaFormatFactory? = null)

Write envelope file to given path using envelopeFormat and optional metaFormat

writeMetaFile
Link copied to clipboard
fun IOPlugin.writeMetaFile(path: Path, meta: Meta, metaFormat: MetaFormatFactory = JsonMetaFormat, descriptor: MetaDescriptor? = null)

Write meta to file using metaFormat. If path is a directory, write a file with name equals name of metaFormat. Like "meta.json"