TemplateSource

sealed interface TemplateSource

Where a template comes from: local content (hashable, uploadable) or a template already known to Carbone.

Inheritors

Types

Link copied to clipboard
class Bytes(content: ByteArray, val fileName: String? = null) : TemplateSource.Content

Content already held in memory.

Link copied to clipboard
object Companion

Factory functions for each TemplateSource variant.

Link copied to clipboard
sealed interface Content : TemplateSource

A template whose bytes are available locally. Its SHA-256 is the legacy Carbone template id.

Link copied to clipboard
class File(val path: Path) : TemplateSource.Content

Content read from a local file; fileName is the file's own name.

Link copied to clipboard
data class Remote(val id: TemplateId) : TemplateSource

A template already stored on Carbone, referenced by id.

Link copied to clipboard
class Stream(val fileName: String? = null, open: () -> InputStream) : TemplateSource.Content

Content read lazily from a caller-supplied InputStream, opened once and cached.