public class URLBlobContainer extends AbstractBlobContainer
BlobContainer
Modifier and Type | Field and Description |
---|---|
protected URLBlobStore |
blobStore |
protected java.net.URL |
path |
Constructor and Description |
---|
URLBlobContainer(URLBlobStore blobStore,
BlobPath blobPath,
java.net.URL path)
Constructs new URLBlobContainer
|
Modifier and Type | Method and Description |
---|---|
boolean |
blobExists(java.lang.String blobName)
This operation is not supported by URLBlobContainer
|
void |
deleteBlob(java.lang.String blobName)
This operation is not supported by URLBlobContainer
|
java.util.Map<java.lang.String,BlobMetaData> |
listBlobs()
This operation is not supported by URLBlobContainer
|
java.util.Map<java.lang.String,BlobMetaData> |
listBlobsByPrefix(java.lang.String blobNamePrefix)
This operation is not supported by URLBlobContainer
|
void |
move(java.lang.String from,
java.lang.String to)
Renames the source blob into the target blob.
|
java.io.InputStream |
readBlob(java.lang.String name)
Creates a new
InputStream for the given blob name. |
java.net.URL |
url()
Returns URL for this container
|
void |
writeBlob(java.lang.String blobName,
java.io.InputStream inputStream,
long blobSize)
Reads blob content from the input stream and writes it to the container in a new blob with the given name.
|
path
protected final URLBlobStore blobStore
protected final java.net.URL path
public URLBlobContainer(URLBlobStore blobStore, BlobPath blobPath, java.net.URL path)
blobStore
- blob storeblobPath
- blob path for this containerpath
- URL for this containerpublic java.net.URL url()
public java.util.Map<java.lang.String,BlobMetaData> listBlobs() throws java.io.IOException
BlobMetaData
, containing basic information about each blob.java.io.IOException
- if there were any failures in reading from the blob container.public java.util.Map<java.lang.String,BlobMetaData> listBlobsByPrefix(java.lang.String blobNamePrefix) throws java.io.IOException
blobNamePrefix
- The prefix to match against blob names in the container.BlobMetaData
, containing basic information about each blob.java.io.IOException
- if there were any failures in reading from the blob container.public void move(java.lang.String from, java.lang.String to) throws java.io.IOException
BlobContainer
BlobContainer
for which atomicity can be guaranteed is the
FsBlobContainer
.from
- The blob to rename.to
- The name of the blob after the renaming.java.io.IOException
- if the source blob does not exist, the target blob already exists,
or there were any failures in reading from the blob container.public void deleteBlob(java.lang.String blobName) throws java.io.IOException
blobName
- The name of the blob to delete.java.nio.file.NoSuchFileException
- if the blob does not existjava.io.IOException
- if the blob exists but could not be deleted.public boolean blobExists(java.lang.String blobName)
blobName
- The name of the blob whose existence is to be determined.true
if a blob exists in the BlobContainer
with the given name, and false
otherwise.public java.io.InputStream readBlob(java.lang.String name) throws java.io.IOException
BlobContainer
InputStream
for the given blob name.name
- The name of the blob to get an InputStream
for.InputStream
to read the blob.java.nio.file.NoSuchFileException
- if the blob does not existjava.io.IOException
- if the blob can not be read.public void writeBlob(java.lang.String blobName, java.io.InputStream inputStream, long blobSize) throws java.io.IOException
BlobContainer
IOException
will be thrown.blobName
- The name of the blob to write the contents of the input stream to.inputStream
- The input stream from which to retrieve the bytes to write to the blob.blobSize
- The size of the blob to be written, in bytes. It is implementation dependent whether
this value is used in writing the blob to the repository.java.nio.file.FileAlreadyExistsException
- if a blob by the same name already existsjava.io.IOException
- if the input stream could not be read, or the target blob could not be written to.