public interface StorageAsset
| Modifier and Type | Method and Description |
|---|---|
void |
create()
Creates the asset in the underlying storage, if it does not exist.
|
boolean |
exists()
Returns true, if the asset exists.
|
Path |
getFilePath()
Returns the real path to the asset, if it exist.
|
Instant |
getModificationTime()
Returns the time of the last modification.
|
String |
getName()
Returns the name of the asset.
|
StorageAsset |
getParent()
Returns the parent of this asset.
|
String |
getPath()
Returns the complete path relative to the repository to the given asset.
|
ReadableByteChannel |
getReadChannel()
Returns a NIO representation of the data.
|
InputStream |
getReadStream()
Returns the input stream of the artifact content.
|
long |
getSize()
The size in bytes of the asset.
|
RepositoryStorage |
getStorage()
Returns the storage this asset belongs to.
|
WritableByteChannel |
getWriteChannel(boolean replace)
Returns a NIO representation of the asset where you can write the data.
|
OutputStream |
getWriteStream(boolean replace)
Returns an output stream where you can write data to the asset.
|
boolean |
hasParent()
Returns true, if there is a parent to this asset.
|
boolean |
isContainer()
Returns true, if this asset is a container type and contains further child assets.
|
boolean |
isFileBased()
Returns true, if the asset can return a file path for the given asset.
|
List<StorageAsset> |
list()
List the child assets.
|
boolean |
replaceDataFromFile(Path newData)
Replaces the content.
|
StorageAsset |
resolve(String toPath)
Returns the asset relative to the given path
|
RepositoryStorage getStorage()
String getPath()
Instant getModificationTime()
boolean isContainer()
List<StorageAsset> list()
long getSize()
InputStream getReadStream() throws IOException
IOExceptionReadableByteChannel getReadChannel() throws IOException
IOExceptionOutputStream getWriteStream(boolean replace) throws IOException
replace - If true, the original data will be replaced, otherwise the data will be appended.IOExceptionWritableByteChannel getWriteChannel(boolean replace) throws IOException
replace - True, if the content should be replaced by the data written to the stream.IOExceptionboolean replaceDataFromFile(Path newData) throws IOException
newData - Replaces the data by the content of the given file.IOExceptionboolean exists()
void create() throws IOException
IOExceptionPath getFilePath() throws UnsupportedOperationException
UnsupportedOperationException, if and only if isFileBased() returns false.UnsupportedOperationException - If the underlying storage is not file based.boolean isFileBased()
getFilePath()
will not throw a UnsupportedOperationExceptionboolean hasParent()
StorageAsset getParent()
null, if it does not exist.StorageAsset resolve(String toPath)
toPath - Copyright © 2006–2019 The Apache Software Foundation. All rights reserved.