public final class BlobClient extends Object implements Closeable
This class is not thread-safe.
| Constructor and Description |
|---|
BlobClient(InetSocketAddress serverAddress)
Instantiates a new BLOB client.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
delete(JobID jobId,
String key)
Deletes the BLOB identified by the given job ID and key from the BLOB server.
|
void |
deleteAll(JobID jobId)
Deletes all BLOBs belonging to the job with the given ID from the BLOB server
|
InputStream |
get(BlobKey blobKey)
Downloads the BLOB identified by the given BLOB key from the BLOB server.
|
InputStream |
get(JobID jobID,
String key)
Downloads the BLOB identified by the given job ID and key from the BLOB server.
|
BlobKey |
put(byte[] value)
Uploads the data of the given byte array to the BLOB server in a content-addressable manner.
|
BlobKey |
put(byte[] value,
int offset,
int len)
Uploads data from the given byte array to the BLOB server in a content-addressable manner.
|
BlobKey |
put(InputStream inputStream)
Uploads the data from the given input stream to the BLOB server in a content-addressable manner.
|
void |
put(JobID jobId,
String key,
byte[] value)
Uploads the data of the given byte array to the BLOB server and stores it under the given job ID and key.
|
void |
put(JobID jobId,
String key,
byte[] value,
int offset,
int len)
Uploads data from the given byte array to the BLOB server and stores it under the given job ID and key.
|
void |
put(JobID jobId,
String key,
InputStream inputStream)
Uploads data from the given input stream to the BLOB server and stores it under the given job ID and key.
|
public BlobClient(InetSocketAddress serverAddress) throws IOException
serverAddress - the network address of the BLOB serverIOException - thrown if the connection to the BLOB server could not be establishedpublic BlobKey put(byte[] value) throws IOException
value - the buffer to uploadIOException - thrown if an I/O error occurs while uploading the data to the BLOB serverpublic BlobKey put(byte[] value, int offset, int len) throws IOException
value - the buffer to upload data fromoffset - the read offset within the bufferlen - the number of bytes to upload from the bufferIOException - thrown if an I/O error occurs while uploading the data to the BLOB serverpublic void put(JobID jobId, String key, byte[] value) throws IOException
jobId - the job ID to identify the uploaded datakey - the key to identify the uploaded datavalue - the buffer to uploadIOException - thrown if an I/O error occurs while uploading the data to the BLOB serverpublic void put(JobID jobId, String key, byte[] value, int offset, int len) throws IOException
jobId - the job ID to identify the uploaded datakey - the key to identify the uploaded datavalue - the buffer to upload data fromoffset - the read offset within the bufferlen - the number of bytes to upload from the bufferIOException - thrown if an I/O error occurs while uploading the data to the BLOB serverpublic void put(JobID jobId, String key, InputStream inputStream) throws IOException
jobId - the job ID to identify the uploaded datakey - the key to identify the uploaded datainputStream - the input stream to read the data fromIOException - thrown if an I/O error occurs while reading the data from the input stream or uploading the data to the
BLOB serverpublic BlobKey put(InputStream inputStream) throws IOException
inputStream - the input stream to read the data fromIOException - thrown if an I/O error occurs while reading the data from the input stream or uploading the data to the
BLOB serverpublic void delete(JobID jobId, String key) throws IOException
jobId - the job ID to identify the BLOBkey - the key to identify the BLOBIOException - thrown if an I/O error occurs while transferring the request to the BLOB serverpublic void deleteAll(JobID jobId) throws IOException
jobId - the job ID to identify the BLOBs to be deletedIOException - thrown if an I/O error occurs while transferring the request to the BLOB serverpublic InputStream get(JobID jobID, String key) throws IOException
FileNotFoundException is thrown.jobID - the job ID identifying the BLOB to downloadkey - the key identifying the BLOB to downloadIOException - thrown if an I/O error occurs during the downloadpublic InputStream get(BlobKey blobKey) throws IOException
FileNotFoundException is thrown.blobKey - the BLOB key identifying the BLOB to downloadIOException - thrown if an I/O error occurs during the downloadpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2015 The Apache Software Foundation. All rights reserved.