org.jclouds.blobstore.BlobStore.blobBuilder()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(205)

本文整理了Java中org.jclouds.blobstore.BlobStore.blobBuilder()方法的一些代码示例,展示了BlobStore.blobBuilder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.blobBuilder()方法的具体详情如下:
包路径:org.jclouds.blobstore.BlobStore
类名称:BlobStore
方法名:blobBuilder

BlobStore.blobBuilder介绍

暂无

代码示例

代码示例来源:origin: apache/usergrid

BlobBuilder blobBuilder = blobStore.blobBuilder( filename )
  .payload( ephemeral )
  .contentMD5(Files.hash( ephemeral, Hashing.md5() ))
  .contentType("application/json");
final String uploadedFile = blobStore.putBlob(
  bucketName, blob, PutOptions.Builder.multipart() );

代码示例来源:origin: jclouds/legacy-jclouds

@VisibleForTesting
Blob newBlobWithMD5(String name, Object value) {
 Blob blob = blobstore.blobBuilder(prefixer.apply(name)).payload(newPayload(value)).build();
 try {
   Payloads.calculateMD5(blob);
 } catch (IOException e) {
   Throwables.propagate(e);
 }
 return blob;
}

代码示例来源:origin: jclouds/legacy-jclouds

@Test
public void testSignPutBlob() throws Exception {
 BlobStore signPutBlob = requestsSendResponses(init());
 Blob blob = signPutBlob.blobBuilder("name").forSigning().contentLength(2l).contentMD5(new byte[] { 0, 2, 4, 8 })
    .contentType("text/plain").expires(new Date(1000)).build();
 HttpRequest compare = putBlob();
 compare.setPayload(blob.getPayload());
 assertEquals(signPutBlob.getContext().getSigner().signPutBlob(container, blob), compare);
}

代码示例来源:origin: apache/usergrid

BlobBuilder blobBuilder = blobStore.blobBuilder( filename )
  .payload( uploadFile )
  .contentMD5(Files.hash( uploadFile, Hashing.md5()))
  .contentType( "application/json" );
final String uploadedFile = blobStore.putBlob( bucketName, blob, PutOptions.Builder.multipart() );

代码示例来源:origin: org.jclouds/jclouds-blobstore

@VisibleForTesting
Blob newBlobWithMD5(String name, Object value) {
 Blob blob = blobstore.blobBuilder(prefixer.apply(name)).payload(newPayload(value)).build();
 try {
   Payloads.calculateMD5(blob);
 } catch (IOException e) {
   Throwables.propagate(e);
 }
 return blob;
}

代码示例来源:origin: apache/jclouds

@Test
public void testSignPutBlob() throws Exception {
 HashCode hashCode = HashCode.fromBytes(new byte[16]);
 BlobStore signPutBlob = requestsSendResponses(init());
 Blob blob = signPutBlob.blobBuilder("name").forSigning().contentLength(2L).contentMD5(hashCode)
    .contentType("text/plain").expires(new Date(1000)).build();
 HttpRequest compare = putBlob();
 compare.setPayload(blob.getPayload());
 assertEquals(signPutBlob.getContext().getSigner().signPutBlob(container, blob), compare);
}

代码示例来源:origin: rackerlabs/blueflood

public void publish(String remoteName, byte[] payload) throws IOException {
    Timer.Context ctx = uploadTimer.time();
    try {
      Blob blob = blobStore.blobBuilder(remoteName).payload(payload)
          .contentType("application/json")
          .contentEncoding(remoteName.endsWith(".gz") ? "gzip" : "identity")
          .calculateMD5().build();

      String containerName = CONTAINER_DATE_FORMAT.format(new Date());
      if (!lastContainerCreated.matches(containerName)) {
        createContainer();
      }
      blobStore.putBlob(containerName, blob);
    } finally {
      ctx.stop();
    }
  }
}

代码示例来源:origin: gaul/are-we-consistent-yet

private Blob makeBlob(String blobName, ByteSource payload)
    throws IOException {
  return blobStore.blobBuilder(blobName)
      .payload(payload)
      .contentLength(payload.size())
      .build();
}

代码示例来源:origin: gaul/s3proxy

ByteSource payload = ByteSource.empty();
BlobBuilder.PayloadBlobBuilder builder = blobStore
    .blobBuilder(blobName)
    .payload(payload);
addContentMetdataFromHttpRequest(builder, request);
builder.contentLength(payload.size());
    builder.build().getMetadata(), options);
  blobStore.putBlob(containerName, builder.name(mpu.id()).build(),
      options);

代码示例来源:origin: apache/jclouds

/**
 * Creates a {@link Blob} object filled with data from a file
 *
 * @param keyName
 * @param filePayload
 * @return
 */
private Blob createBlob(String keyName, File filePayload) {
  return blobStore.blobBuilder(keyName).payload(filePayload).build();
}

代码示例来源:origin: gaul/s3proxy

.blobBuilder(blobName)
    .payload(is)
    .contentLength(contentLength);
eTag = blobStore.putBlob(containerName, builder.build(),
    options);

代码示例来源:origin: jclouds/legacy-jclouds

protected void add5BlobsUnderPathAnd5UnderRootToContainer(String sourceContainer) {
 for (Entry<String, String> entry : Iterables.concat(fiveStrings.entrySet(), fiveStringsUnderPath.entrySet())) {
   Blob sourceObject = view.getBlobStore().blobBuilder(entry.getKey()).payload(entry.getValue())
      .contentType("text/xml").build();
   addBlobToContainer(sourceContainer, sourceObject);
 }
}

代码示例来源:origin: gaul/s3proxy

.blobBuilder(blobName)
    .payload(payload);
if (contentType != null) {
  builder.contentType(contentType);
Blob blob = builder.build();
blobStore.putBlob(containerName, blob);

代码示例来源:origin: opendedup/sdfs

@Override
public void checkoutFile(String name) throws IOException {
  name = FilenameUtils.separatorsToUnix(name);
  String blb = "claims/" + name + "/"
      + EncyptUtils.encHashArchiveName(Main.DSEID, Main.chunkStoreEncryptionEnabled);
  Blob b = null;
  b = blobStore.blobBuilder(blb).payload(B2Bytes).contentLength(B2Bytes.length)
      .contentType(MediaType.APPLICATION_OCTET_STREAM).build();
  this.writeBlob(b, false);
}

代码示例来源:origin: jclouds/legacy-jclouds

public void execute(String containerName, String directory) {
   blobStore.putBlob(
      containerName,
      blobStore.blobBuilder(directory + directorySuffix).type(StorageType.RELATIVE_PATH)
         .payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
  }
}

代码示例来源:origin: apache/jclouds

private Blob createDirBlob(String keyName) {
  return blobStore.blobBuilder(keyName)
      .payload(ByteSource.empty())
      .build();
}

代码示例来源:origin: org.jclouds/jclouds-blobstore

public void execute(String containerName, String directory) {
   blobStore.putBlob(
      containerName,
      blobStore.blobBuilder(directory + directorySuffix).type(StorageType.RELATIVE_PATH)
         .payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
  }
}

代码示例来源:origin: apache/jclouds

protected void add5BlobsUnderPathAnd5UnderRootToContainer(String sourceContainer) {
 for (Entry<String, String> entry : Iterables.concat(fiveStrings.entrySet(), fiveStringsUnderPath.entrySet())) {
   Blob sourceObject = view.getBlobStore().blobBuilder(entry.getKey()).payload(entry.getValue())
      .contentType("text/xml").build();
   addBlobToContainer(sourceContainer, sourceObject);
 }
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-blobstore

public void execute(String containerName, String directory) {
   blobStore.putBlob(
      containerName,
      blobStore.blobBuilder(directory + directorySuffix).type(StorageType.RELATIVE_PATH)
         .payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
  }
}

代码示例来源:origin: jclouds/legacy-jclouds

@Override
protected void putStringWithMD5(Map<String, Blob> map, String key, String text) throws IOException {
 map.put(key, view.getBlobStore().blobBuilder(key).payload(text).calculateMD5().build());
}

相关文章