public interface FileManifest
SmithyBuildPlugin.
Mutating FileManifest implementations MUST be thread-safe as they can
be used concurrently across multiple threads when building models.| Modifier and Type | Method and Description |
|---|---|
default void |
addAllFiles(FileManifest manifest)
Adds the files from another FileManifest into this FileManifest.
|
java.nio.file.Path |
addFile(java.nio.file.Path path)
Adds a path to the manifest.
|
static FileManifest |
create(java.nio.file.Path basePath)
Create a default file manifest for the given base path.
|
java.nio.file.Path |
getBaseDir()
Gets the base directory of the manifest.
|
java.util.Set<java.nio.file.Path> |
getFiles()
Gets all of the files in the result.
|
default java.util.List<java.nio.file.Path> |
getFilesIn(java.nio.file.Path path)
Gets the paths to files stored under a prefix.
|
default java.util.List<java.nio.file.Path> |
getFilesIn(java.lang.String path)
Gets the paths to files stored under a prefix.
|
default boolean |
hasFile(java.nio.file.Path file)
Checks if the given file is stored in the manifest.
|
default boolean |
hasFile(java.lang.String file)
Checks if the given file is stored in the manifest.
|
default java.nio.file.Path |
resolvePath(java.nio.file.Path path)
Resolves a path against the base path of the manifest.
|
default java.nio.file.Path |
writeFile(java.nio.file.Path path,
java.lang.Class klass,
java.lang.String resource)
Adds a file to the result using the contents of a resource loaded by
calling
Class.getResourceAsStream(String). |
java.nio.file.Path |
writeFile(java.nio.file.Path path,
java.io.InputStream fileContentsInputStream)
Adds a file to the result using the contents of an
InputStream. |
java.nio.file.Path |
writeFile(java.nio.file.Path path,
java.io.Reader fileContentsReader)
Adds a file to the result using the contents of a
Reader. |
default java.nio.file.Path |
writeFile(java.nio.file.Path path,
java.lang.String fileContentsText)
Adds a UTF-8 encoded file to the result.
|
default java.nio.file.Path |
writeFile(java.lang.String path,
java.lang.Class klass,
java.lang.String resource)
Adds a file to the result using the contents of a resource loaded by
calling
Class.getResourceAsStream(String). |
default java.nio.file.Path |
writeFile(java.lang.String path,
java.io.InputStream fileContentsInputStream)
Adds a file to the result using the contents of an
InputStream. |
default java.nio.file.Path |
writeFile(java.lang.String path,
java.io.Reader fileContentsReader)
Adds a file to the result using the contents of a
Reader. |
default java.nio.file.Path |
writeFile(java.lang.String path,
java.lang.String fileContentsText)
Adds a UTF-8 encoded file to the result.
|
default java.nio.file.Path |
writeJson(java.nio.file.Path path,
Node node)
Adds a Node artifact, converting it automatically to JSON.
|
default java.nio.file.Path |
writeJson(java.lang.String path,
Node node)
Adds a Node artifact, converting it automatically to JSON.
|
static FileManifest create(java.nio.file.Path basePath)
basePath - Base path where files are written.java.nio.file.Path getBaseDir()
java.util.Set<java.nio.file.Path> getFiles()
The order of files returned should be stable across calls.
java.nio.file.Path addFile(java.nio.file.Path path)
The given path must be relative or within the base directory.
path - Path to add.default void addAllFiles(FileManifest manifest)
manifest - Other object to merge with.default java.nio.file.Path resolvePath(java.nio.file.Path path)
path - Path to resolve against the base URL.SmithyBuildException - if the resolved path cannot
falls outside of the base URL of the manifest.java.nio.file.Path writeFile(java.nio.file.Path path,
java.io.Reader fileContentsReader)
Reader.
This method will write the contents of a Reader to a file.
path - Relative path to the file to create.fileContentsReader - Reader to consume and write to the file.java.nio.file.Path writeFile(java.nio.file.Path path,
java.io.InputStream fileContentsInputStream)
InputStream.
This method will write the contents of an input stream to a file.
path - Relative path to the file to create.fileContentsInputStream - InputStream to consume and write to the file.default java.nio.file.Path writeFile(java.nio.file.Path path,
java.lang.Class klass,
java.lang.String resource)
Class.getResourceAsStream(String).
This method should be preferred when writing class resources to the manifest
since it handles closing the created InputStream and avoids
tripping up tools like SpotBugs.
path - Relative path to the file to create.klass - Class to load the resource from.resource - Path to the resource to load.default java.nio.file.Path writeFile(java.lang.String path,
java.lang.Class klass,
java.lang.String resource)
Class.getResourceAsStream(String).path - Relative path to the file to create.klass - Class to load the resource from.resource - Path to the resource to load.default java.nio.file.Path writeFile(java.nio.file.Path path,
java.lang.String fileContentsText)
This method will write the contents of a string to a file.
path - Relative path to the file to create.fileContentsText - String value to write to the file.default java.nio.file.Path writeFile(java.lang.String path,
java.lang.String fileContentsText)
This method will write the contents of a string to a file.
path - Relative path to the file to create.fileContentsText - String value to write to the file.default java.nio.file.Path writeFile(java.lang.String path,
java.io.Reader fileContentsReader)
Reader.
This method will write the contents of a Reader to a file.
path - Relative path to the file to create.fileContentsReader - Reader to consume and write to the file.default java.nio.file.Path writeFile(java.lang.String path,
java.io.InputStream fileContentsInputStream)
InputStream.
This method will write the contents of an input stream to a file.
path - Relative path to the file to create.fileContentsInputStream - InputStream to consume and write to the file.default java.nio.file.Path writeJson(java.nio.file.Path path,
Node node)
path - Relative path to write to.node - Node data to write to JSON.default java.nio.file.Path writeJson(java.lang.String path,
Node node)
path - Relative path to write to.node - Node data to write to JSON.default boolean hasFile(java.nio.file.Path file)
file - File to check.default boolean hasFile(java.lang.String file)
file - File to check.default java.util.List<java.nio.file.Path> getFilesIn(java.nio.file.Path path)
path - Path prefix.default java.util.List<java.nio.file.Path> getFilesIn(java.lang.String path)
path - Path prefix.