public ArrayList<PageRange> downloadPageRanges(BlobRequestOptions options, OperationContext opContext) throws StorageException { return ((CloudPageBlob) getBlob()).downloadPageRanges( null, options, opContext); } }
public ArrayList<PageRange> downloadPageRanges(BlobRequestOptions options, OperationContext opContext) throws StorageException { return ((CloudPageBlob) getBlob()).downloadPageRanges( null, options, opContext); } }
/** * Returns a collection of page ranges and their starting and ending byte offsets. * <p> * The start and end byte offsets for each page range are inclusive. * * @return An <code>ArrayList</code> object which represents the set of page ranges and their starting and ending * byte offsets. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public ArrayList<PageRange> downloadPageRanges() throws StorageException { return this.downloadPageRanges(null /* accessCondition */, null /* options */, null /* opContext */); }
/** * Returns a collection of page ranges and their starting and ending byte offsets. * <p> * The start and end byte offsets for each page range are inclusive. * * @return An <code>ArrayList</code> object which represents the set of page ranges and their starting and ending * byte offsets. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public ArrayList<PageRange> downloadPageRanges() throws StorageException { return this.downloadPageRanges(null /* accessCondition */, null /* options */, null /* opContext */); }
/** * Returns a collection of page ranges and their starting and ending byte offsets. * * @param offset * The starting offset of the data range over which to list page ranges, in bytes. Must be a multiple of * 512. * @param length * The length of the data range over which to list page ranges, in bytes. Must be a multiple of 512. * @return A <code>List</code> object which represents the set of page ranges and their starting and ending * byte offsets. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public List<PageRange> downloadPageRanges(final long offset, final Long length) throws StorageException { return this.downloadPageRanges(offset, length, null /* accessCondition */, null /* options */, null /* opContext */); }
/** * Returns a collection of page ranges and their starting and ending byte offsets. * * @param offset * The starting offset of the data range over which to list page ranges, in bytes. Must be a multiple of * 512. * @param length * The length of the data range over which to list page ranges, in bytes. Must be a multiple of 512. * @return A <code>List</code> object which represents the set of page ranges and their starting and ending * byte offsets. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public List<PageRange> downloadPageRanges(final long offset, final Long length) throws StorageException { return this.downloadPageRanges(offset, length, null /* accessCondition */, null /* options */, null /* opContext */); }
private void getPageBlobRanges(Exchange exchange) throws Exception { CloudPageBlob client = BlobServiceUtil.createPageBlobClient(getConfiguration()); BlobServiceUtil.configureCloudBlobForRead(client, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); LOG.trace("Getting the page blob ranges [{}] from exchange [{}]...", getConfiguration().getBlobName(), exchange); List<PageRange> ranges = client.downloadPageRanges(opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); ExchangeUtil.getMessageForResponse(exchange).setBody(ranges); }
@Test public void testDownloadPageRangesWithOffsetAndLength() throws StorageException, URISyntaxException, IOException { final CloudPageBlob blobRef = setUpPageRanges(); List<PageRange> actualPageRanges = blobRef.downloadPageRanges((long)1*512, (long)5*512); List<PageRange> expectedPageRanges = new ArrayList<PageRange>(); expectedPageRanges.add(new PageRange(2 * 512, 5 * 512 - 1)); assertEquals(expectedPageRanges.size(), actualPageRanges.size()); for (int i = 0; i < expectedPageRanges.size(); i++) { assertEquals(expectedPageRanges.get(i).getStartOffset(), actualPageRanges.get(i).getStartOffset()); assertEquals(expectedPageRanges.get(i).getEndOffset(), actualPageRanges.get(i).getEndOffset()); } }
@Test public void testDownloadPageRangesWithOffset() throws StorageException, URISyntaxException, IOException { final CloudPageBlob blobRef = setUpPageRanges(); List<PageRange> actualPageRanges = blobRef.downloadPageRanges((long)1*512, null); List<PageRange> expectedPageRanges = new ArrayList<PageRange>(); expectedPageRanges.add(new PageRange(2 * 512, 5 * 512 - 1)); expectedPageRanges.add(new PageRange(6 * 512, 7 * 512 - 1)); assertEquals(expectedPageRanges.size(), actualPageRanges.size()); for (int i = 0; i < expectedPageRanges.size(); i++) { assertEquals(expectedPageRanges.get(i).getStartOffset(), actualPageRanges.get(i).getStartOffset()); assertEquals(expectedPageRanges.get(i).getEndOffset(), actualPageRanges.get(i).getEndOffset()); } }
@Test public void testDownloadPages() throws StorageException, URISyntaxException, IOException { final CloudPageBlob blobRef = setUpPageRanges(); ArrayList<PageRange> actualPageRanges = blobRef.downloadPageRanges(); ArrayList<PageRange> expectedPageRanges = new ArrayList<PageRange>(); expectedPageRanges.add(new PageRange(0, 512 - 1)); expectedPageRanges.add(new PageRange(2 * 512, 5 * 512 - 1)); expectedPageRanges.add(new PageRange(6 * 512, 7 * 512 - 1)); assertEquals(expectedPageRanges.size(), actualPageRanges.size()); for (int i = 0; i < expectedPageRanges.size(); i++) { assertEquals(expectedPageRanges.get(i).getStartOffset(), actualPageRanges.get(i).getStartOffset()); assertEquals(expectedPageRanges.get(i).getEndOffset(), actualPageRanges.get(i).getEndOffset()); } }
@Test public void testEightTBBlob() throws StorageException, URISyntaxException, IOException { CloudPageBlob blob = this.container.getPageBlobReference("blob1"); CloudPageBlob blob2 = this.container.getPageBlobReference("blob1"); long eightTb = 8L * 1024L * 1024L * 1024L * 1024L; blob.create(eightTb); assertEquals(eightTb, blob.getProperties().getLength()); blob2.downloadAttributes(); assertEquals(eightTb, blob2.getProperties().getLength()); for (ListBlobItem listBlob : this.container.listBlobs()) { CloudPageBlob listPageBlob = (CloudPageBlob)listBlob; assertEquals(eightTb, listPageBlob.getProperties().getLength()); } CloudPageBlob blob3 = this.container.getPageBlobReference("blob3"); blob3.create(1024); blob3.resize(eightTb); final Random randGenerator = new Random(); final byte[] buffer = new byte[1024]; randGenerator.nextBytes(buffer); blob.uploadPages(new ByteArrayInputStream(buffer), eightTb - 512L, 512L); ArrayList<PageRange> ranges = blob.downloadPageRanges(); assertEquals(1, ranges.size()); assertEquals(eightTb - 512L, ranges.get(0).getStartOffset()); assertEquals(eightTb - 1L, ranges.get(0).getEndOffset()); }