WriteableRevFileRegistry

Write access for a revisioned file registry.

See also

Inheritors

Types

Link copied to clipboard
interface Entry

Describes registration data to create a revisioned file from.

Functions

Link copied to clipboard
fun WriteableRevFileRegistry.create(originalName: String, contentType: ContentType = ContentType.defaultForFilePath(originalName), content: () -> OutgoingContent.ReadChannelContent): RevisionedFile

Creates a new custom RevisionedFile and adds it to this WriteableRevFileRegistry.

Link copied to clipboard
fun WriteableRevFileRegistry.file(file: File, contentType: ContentType = ContentType.defaultForFile(file), name: String = file.name): RevisionedFile

Creates a new RevisionedFile from the given file and adds it to this WriteableRevFileRegistry.

Link copied to clipboard
abstract operator fun get(path: String): RevisionedFile?

Returns the revisioned file associated with the given path, or null if no such file exists.

Link copied to clipboard
abstract operator fun iterator(): Iterator<RevisionedFile>
Link copied to clipboard

Registers the given entry and returns its associated revisioned file.

Link copied to clipboard
fun WriteableRevFileRegistry.resource(resource: String, name: String = resource.substringAfterLast('/'), contentType: ContentType = ContentType.defaultForFilePath(resource), classLoader: ClassLoader = checkNotNull(this::class.java.classLoader) { "Failed to get a class loader for loading resource '$resource'." }): RevisionedFile

Creates a new RevisionedFile from the given JVM resource and adds it to this WriteableRevFileRegistry.

Link copied to clipboard
abstract fun size(): Int

Returns the number of registered files.

Link copied to clipboard
fun WriteableRevFileRegistry.source(originalName: String, contentType: ContentType = ContentType.defaultForFilePath(originalName), content: () -> Source): RevisionedFile
fun WriteableRevFileRegistry.source(path: Path, contentType: ContentType = ContentType.defaultForFilePath(path.toString()), originalName: String = path.name, fileSystem: FileSystem = SystemFileSystem): RevisionedFile

Creates a new RevisionedFile from the given source and adds it to this WriteableRevFileRegistry.

Link copied to clipboard
fun WriteableRevFileRegistry.uri(uri: URI, name: String = uri.toString().substringAfterLast('/'), contentType: ContentType = ContentType.defaultForFilePath(uri.path)): RevisionedFile

Creates a new RevisionedFile from the given URI and adds it to this WriteableRevFileRegistry.

Link copied to clipboard
fun WriteableRevFileRegistry.url(url: URL, name: String = url.toString().substringAfterLast('/'), contentType: ContentType = ContentType.defaultForFilePath(url.path)): RevisionedFile

Creates a new RevisionedFile from the given URL and adds it to this WriteableRevFileRegistry.