public class CopyWriter extends Object implements Restorable<CopyWriter>
CopyWriter object allows to copy both blob's data and
information. To override source blob's information supply a BlobInfo to the
CopyRequest using either
Storage.CopyRequest.Builder.target(BlobInfo, Storage.BlobTargetOption...) or
Storage.CopyRequest.Builder.target(BlobInfo, Iterable).
This class holds the result of a copy request. If source and
destination blobs share the same location and storage class the copy is completed in one RPC call
otherwise one or more copyChunk() calls are necessary to complete the copy. In addition,
result() can be used to automatically complete the copy and return information
on the newly created blob.
| Modifier and Type | Method and Description |
|---|---|
long |
blobSize()
Returns the size of the blob being copied.
|
RestorableState<CopyWriter> |
capture() |
void |
copyChunk()
Copies the next chunk of the blob.
|
boolean |
isDone()
Returns
true if blob copy has finished, false otherwise. |
Blob |
result()
Returns the updated information for the written blob.
|
long |
totalBytesCopied()
Returns the number of bytes copied.
|
public Blob result()
isDone()
is false will block until all pending chunks are copied.
This method has the same effect of doing:
while (!copyWriter.isDone()) {
copyWriter.copyChunk();
}
StorageException - upon failurepublic long blobSize()
public boolean isDone()
true if blob copy has finished, false otherwise.public long totalBytesCopied()
public void copyChunk()
isDone() returns false).StorageException - upon failurepublic RestorableState<CopyWriter> capture()
capture in interface Restorable<CopyWriter>Copyright © 2016 Google. All rights reserved.