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)
Atomically 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,
BytesReference data)
Writes the input bytes to a new blob in the container with the given name.
|
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.
|
deleteBlobs, deleteBlobsByPrefix, 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
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.io.IOException
- if the blob does not exist, or 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.io.IOException
- if the blob does not exist or 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.io.IOException
- if the input stream could not be read, a blob by the same name already exists,
or the target blob could not be written to.public void writeBlob(java.lang.String blobName, BytesReference data) throws java.io.IOException
BlobContainer
IOException
will be thrown.
TODO: Remove this in favor of a single BlobContainer.writeBlob(String, InputStream, long)
method.
See https://github.com/elastic/elasticsearch/issues/18528writeBlob
in interface BlobContainer
writeBlob
in class AbstractBlobContainer
blobName
- The name of the blob to write the contents of the input stream to.data
- The bytes to write to the blob.java.io.IOException
- if a blob by the same name already exists, or the target blob could not be written to.