bucketName, blob, PutOptions.Builder.multipart() );
final String uploadedFile = blobStore.putBlob( bucketName, blob, PutOptions.Builder.multipart() );
public synchronized void putIfAbsent(File file) throws FileNotFoundException { allocateContainer(); BlobStore store = context.getBlobStore(); if (!store.blobExists(container, file.getName())) { LOG.info("Uploading '{}' to '{}' blob cache.", file.getName(), container); Blob blob = context.getBlobStore().blobBuilder(container) .name(file.getName()) .payload(file) .contentLength(file.length()) .build(); store.putBlob(container, blob, multipart()); } }
public static PutOptions fromPutOptions(PutOptions putOptions) { return multipart(putOptions.multipart); }
public synchronized void putIfAbsent(File file) throws FileNotFoundException { allocateContainer(); BlobStore store = context.getBlobStore(); if (!store.blobExists(container, file.getName())) { LOG.info("Uploading '{}' to '{}' blob cache.", file.getName(), container); Blob blob = context.getBlobStore().blobBuilder(container) .name(file.getName()) .payload(file) .contentLength(file.length()) .build(); store.putBlob(container, blob, multipart()); } }
public void testMultipartChunkedFileStream() throws IOException, InterruptedException { Files.copy(oneHundredOneConstitutions, new File("target/const.txt")); String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); blobStore.createContainerInLocation(null, containerName); Blob blob = blobStore.blobBuilder("const.txt") .payload(new File("target/const.txt")).contentMD5(oneHundredOneConstitutionsMD5).build(); blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart()); } finally { returnContainer(containerName); } } }
/** * @see PutOptions#multipart() */ public static PutOptions multipart() { return multipart(true); }
protected void addMultipartBlobToContainer(String containerName, String key) throws IOException { ByteSource sourceToUpload = TestUtils.randomByteSource().slice(0, PART_SIZE + 1); BlobStore blobStore = view.getBlobStore(); blobStore.createContainerInLocation(null, containerName); Blob blob = blobStore.blobBuilder(key).payload(sourceToUpload).contentLength(sourceToUpload.size()) .contentType(MediaType.TEXT_PLAIN).build(); blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart()); }
@Override public String putBlob(String container, Blob blob) { return putBlob(container, blob, PutOptions.Builder.multipart()); }
@Test public void uploadMultipartBlob() { Blob blob = blobStore.blobBuilder(bigFile.getName()) .payload(new FilePayload(bigFile)) .build(); // configure the blobstore to use multipart uploading of the file String eTag = blobStore.putBlob(CONTAINER, blob, multipart(executor)); // assertEquals(eTag, etag); // The etag returned by Swift is not the md5 of the Blob uploaded // It is the md5 of the concatenated segment md5s }
public static PutOptions fromPutOptions(PutOptions putOptions) { return multipart(putOptions.multipart); }
/** * Writes {@link Payload} to the {@link BlobStore}. */ public static void writeBlob(BlobStore blobStore, String container, String blobName, Payload payload) { if (blobName != null && payload != null) { mkDirs(blobStore, container, blobName); Blob blob = blobStore.blobBuilder(blobName).payload(payload).contentType(MediaType.APPLICATION_OCTET_STREAM).contentDisposition(blobName).build(); blobStore.putBlob(container, blob, multipart()); } }
/** * @see PutOptions#multipart() */ public static PutOptions multipart() { return multipart(true); }
/** * @see PutOptions#multipart() */ public static PutOptions multipart() { return multipart(true); }
/** * @see PutOptions#multipart() */ public static PutOptions multipart() { return multipart(true); }
public void testMultipartChunkedFileStream() throws IOException, InterruptedException { File file = new File("target/const.txt"); Files.copy(oneHundredOneConstitutions, file); String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); blobStore.createContainerInLocation(null, containerName); Blob blob = blobStore.blobBuilder("const.txt").payload(file).build(); blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart()); } finally { returnContainer(containerName); } }
/** * @see PutOptions#multipart() */ public static PutOptions multipart() { return multipart(true); }
public void testMultipartAsynchronouslySmallBlob() throws IOException, InterruptedException, Exception { String containerName = getContainerName(); try { AsyncBlobStore asyncBlobStore = view.getAsyncBlobStore(); asyncBlobStore.createContainerInLocation(null, containerName).get(); Blob blob = asyncBlobStore.blobBuilder("small").payload("small").build(); asyncBlobStore.putBlob(containerName, blob, PutOptions.Builder.multipart()).get(); } finally { returnContainer(containerName); } }
/** * @see PutOptions#multipart() */ public static PutOptions multipart() { return multipart(true); }
/** * @see PutOptions#multipart() */ public static PutOptions multipart() { return multipart(true); }