当前位置: 首页>>代码示例>>Java>>正文


Java CloudPageBlob类代码示例

本文整理汇总了Java中com.microsoft.azure.storage.blob.CloudPageBlob的典型用法代码示例。如果您正苦于以下问题:Java CloudPageBlob类的具体用法?Java CloudPageBlob怎么用?Java CloudPageBlob使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CloudPageBlob类属于com.microsoft.azure.storage.blob包,在下文中一共展示了CloudPageBlob类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSnapshotFileKeys

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
private Map<String, Long> getSnapshotFileKeys(CloudBlobContainer container, String keyPrefix) {
  Map<String, Long> snapshotFiles = new HashMap<>();

  try {
    for (ListBlobItem item : container.listBlobs(keyPrefix, true)) {
      if (item instanceof CloudPageBlob) {
        CloudPageBlob cloudBlob = (CloudPageBlob) item;
        snapshotFiles.put(cloudBlob.getName(), getOriginalFileSize(cloudBlob));
      }
    }
  } catch (StorageException e) {
    logger.error("Unable to retrieve metadata.", e);
    // all or none
    snapshotFiles = new HashMap<>();
  }
  return snapshotFiles;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:18,代码来源:AzureStorageDriver.java

示例2: testCopyPageBlobSas

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
@Test
@Category(SlowTests.class)
public void testCopyPageBlobSas() throws Exception {
    // Create source on server.
    final CloudBlobContainer container = BlobTestHelper.getRandomContainerReference();
    try {
        container.create();
        final CloudPageBlob source = container.getPageBlobReference("source");

        source.getMetadata().put("Test", "value");
        final int length = 512;
        final ByteArrayInputStream data = BlobTestHelper.getRandomDataStream(length);
        source.upload(data, length);

        final CloudFile destination = doCloudBlobCopy(source, length);

        final ByteArrayOutputStream copyData = new ByteArrayOutputStream();
        destination.download(copyData);
        BlobTestHelper.assertStreamsAreEqual(data, new ByteArrayInputStream(copyData.toByteArray()));
    }
    finally {
        container.deleteIfExists();
    }
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:25,代码来源:CloudFileTests.java

示例3: next

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
@Override
public ListBlobItem next() {
  ListBlobItem unwrapped = present.next();
  if (unwrapped instanceof CloudBlobDirectory) {
    return new CloudBlobDirectoryWrapperImpl((CloudBlobDirectory) unwrapped);
  } else if (unwrapped instanceof CloudBlockBlob) {
    return new CloudBlockBlobWrapperImpl((CloudBlockBlob) unwrapped);
  } else if (unwrapped instanceof CloudPageBlob) {
    return new CloudPageBlobWrapperImpl((CloudPageBlob) unwrapped);
  } else {
    return unwrapped;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:StorageInterfaceImpl.java

示例4: downloadPageRanges

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
public ArrayList<PageRange> downloadPageRanges(BlobRequestOptions options,
    OperationContext opContext) throws StorageException {
  return ((CloudPageBlob) getBlob()).downloadPageRanges(
      null, options, opContext);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:StorageInterfaceImpl.java

示例5: getOriginalFileSize

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
private long getOriginalFileSize(CloudPageBlob pageBlobReference) throws StorageException {
  long size = 0;

  pageBlobReference.downloadAttributes();
  HashMap<String, String> map = pageBlobReference.getMetadata();
  if (map != null && map.size() > 0) {
    try {
      size = Long.parseLong(map.get(ORIGINAL_SIZE_KEY));
    } catch (Exception e) {
      logger.error("File size metadata missing or is not a number.");
    }
  }

  return size;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:16,代码来源:AzureStorageDriver.java

示例6: conditionalExtendFile

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
/**
 * Extend the page blob file if we are close to the end.
 */
private void conditionalExtendFile() {

  // maximum allowed size of an Azure page blob (1 terabyte)
  final long MAX_PAGE_BLOB_SIZE = 1024L * 1024L * 1024L * 1024L;

  // If blob is already at the maximum size, then don't try to extend it.
  if (currentBlobSize == MAX_PAGE_BLOB_SIZE) {
    return;
  }

  // If we are within the maximum write size of the end of the file,
  if (currentBlobSize - currentBlobOffset <= MAX_RAW_BYTES_PER_REQUEST) {

    // Extend the file. Retry up to 3 times with back-off.
    CloudPageBlob cloudPageBlob = (CloudPageBlob) blob.getBlob();
    long newSize = currentBlobSize + configuredPageBlobExtensionSize;

    // Make sure we don't exceed maximum blob size.
    if (newSize > MAX_PAGE_BLOB_SIZE) {
      newSize = MAX_PAGE_BLOB_SIZE;
    }
    final int MAX_RETRIES = 3;
    int retries = 1;
    boolean resizeDone = false;
    while(!resizeDone && retries <= MAX_RETRIES) {
      try {
        cloudPageBlob.resize(newSize);
        resizeDone = true;
        currentBlobSize = newSize;
      } catch (StorageException e) {
        LOG.warn("Failed to extend size of " + cloudPageBlob.getUri());
        try {

          // sleep 2, 8, 18 seconds for up to 3 retries
          Thread.sleep(2000 * retries * retries);
        } catch (InterruptedException e1) {

          // Restore the interrupted status
          Thread.currentThread().interrupt();
        }
      } finally {
        retries++;
      }
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:PageBlobOutputStream.java

示例7: CloudPageBlobWrapperImpl

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
public CloudPageBlobWrapperImpl(CloudPageBlob blob) {
  super(blob);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:StorageInterfaceImpl.java

示例8: create

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
public void create(final long length, BlobRequestOptions options,
    OperationContext opContext) throws StorageException {
  ((CloudPageBlob) getBlob()).create(length, null, options, opContext);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:StorageInterfaceImpl.java

示例9: uploadPages

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
public void uploadPages(final InputStream sourceStream, final long offset,
    final long length, BlobRequestOptions options, OperationContext opContext)
    throws StorageException, IOException {
  ((CloudPageBlob) getBlob()).uploadPages(sourceStream, offset, length, null,
      options, opContext);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:StorageInterfaceImpl.java

示例10: PageBlobOutputStream

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
public PageBlobOutputStream(CloudPageBlob pageBlob, long initialPageSize) throws StorageException {
  // to set the size we need to calc but that can't be the first line when we need to construct the super:(
  super(pageBlob.openWriteNew(initialPageSize));
  this.pageBlob = pageBlob;
  resize(initialPageSize);
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:7,代码来源:PageBlobOutputStream.java

示例11: LeaseBlobManager

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
public LeaseBlobManager(CloudPageBlob leaseBlob) {
  this.leaseBlob = leaseBlob;
}
 
开发者ID:apache,项目名称:samza,代码行数:4,代码来源:LeaseBlobManager.java

示例12: getBlob

import com.microsoft.azure.storage.blob.CloudPageBlob; //导入依赖的package包/类
public CloudPageBlob getBlob() {
  return this.blob;
}
 
开发者ID:apache,项目名称:samza,代码行数:4,代码来源:BlobUtils.java


注:本文中的com.microsoft.azure.storage.blob.CloudPageBlob类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。