Class FileRenderer
- java.lang.Object
-
- io.virtdata.docsys.metafs.fs.renderfs.api.FileRenderer
-
- All Implemented Interfaces:
FileContentRenderer
public class FileRenderer extends java.lang.Object implements FileContentRenderer
-
-
Constructor Summary
Constructors Constructor Description FileRenderer(java.lang.String sourceExtension, java.lang.String targetExtension, boolean isCaseSensitive, TemplateCompiler... compilers)Create a file renderer from a source extension to a target extension, which will yield the virtual contents of the target file by applying a set of renderers to the source file data.
-
Method Summary
Modifier and Type Method Description java.nio.file.PathgetRenderedTargetName(java.nio.file.Path sourceName)java.lang.StringgetSourceExtension()java.nio.file.PathgetSourcePath(java.nio.file.Path targetName)Return the matching source path, but only if the target name matches the target extension.java.util.regex.PatterngetSourcePattern()java.lang.StringgetTargetExtension()java.util.regex.PatterngetTargetPattern()java.lang.StringgetTargetSuffix()java.nio.ByteBufferrender(java.nio.file.Path sourcePath, java.nio.file.Path targetPath, java.nio.ByteBuffer byteBuffer)java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.virtdata.docsys.metafs.fs.renderfs.api.FileContentRenderer
canRender, getByteBuffer, getByteChannel, getInputStream, getRendered, hasSource, matchesSource, matchesTarget
-
-
-
-
Constructor Detail
-
FileRenderer
public FileRenderer(java.lang.String sourceExtension, java.lang.String targetExtension, boolean isCaseSensitive, TemplateCompiler... compilers)Create a file renderer from a source extension to a target extension, which will yield the virtual contents of the target file by applying a set of renderers to the source file data.- Parameters:
sourceExtension- The extension of the source (actual) file, including the dot and extension name.targetExtension- The extension of the target (virtual) file, including the dot and extension name.isCaseSensitive- Whether or not to do case-sensitive matching against the source and target extensions.compilers- A lookup function which can create a renderer for a specific path as needed.
-
-
Method Detail
-
getSourcePattern
public java.util.regex.Pattern getSourcePattern()
- Specified by:
getSourcePatternin interfaceFileContentRenderer- Returns:
- a pattern that can be used to match path names which serve as the source data of rendered files.
-
getTargetPattern
public java.util.regex.Pattern getTargetPattern()
- Specified by:
getTargetPatternin interfaceFileContentRenderer- Returns:
- a pattern that can be used to match path names which are to be dynamically rendered from source file content.
-
getSourceExtension
public java.lang.String getSourceExtension()
-
getTargetExtension
public java.lang.String getTargetExtension()
-
getSourcePath
public java.nio.file.Path getSourcePath(java.nio.file.Path targetName)
Description copied from interface:FileContentRendererReturn the matching source path, but only if the target name matches the target extension.- Specified by:
getSourcePathin interfaceFileContentRenderer- Parameters:
targetName- The target Path which represents the intended to be rendered- Returns:
- A source path, or null if the target name does not match for this renderer
-
getRenderedTargetName
public java.nio.file.Path getRenderedTargetName(java.nio.file.Path sourceName)
- Specified by:
getRenderedTargetNamein interfaceFileContentRenderer
-
getTargetSuffix
public java.lang.String getTargetSuffix()
- Specified by:
getTargetSuffixin interfaceFileContentRenderer
-
render
public java.nio.ByteBuffer render(java.nio.file.Path sourcePath, java.nio.file.Path targetPath, java.nio.ByteBuffer byteBuffer)- Specified by:
renderin interfaceFileContentRenderer
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-