/** * Sets this {@link EntityProperty} using the serialized <code>Byte[]</code> value. * * @param value * The <code>Byte[]</code> value to set as the {@link EntityProperty} value. This value may be * <code>null</code>. */ public synchronized final void setValue(final Byte[] value) { this.edmType = EdmType.BINARY; this.type = Byte[].class; this.value = value == null ? null : Base64.encode(value); }
/** * Sets this {@link EntityProperty} using the serialized <code>Byte[]</code> value. * * @param value * The <code>Byte[]</code> value to set as the {@link EntityProperty} value. This value may be * <code>null</code>. */ public synchronized final void setValue(final Byte[] value) { this.edmType = EdmType.BINARY; this.type = Byte[].class; this.value = value == null ? null : Base64.encode(value); }
/** * Sets this {@link EntityProperty} using the serialized <code>byte[]</code> value. * * @param value * The <code>byte[]</code> value to set as the {@link EntityProperty} value. This value may be * <code>null</code>. */ public synchronized final void setValue(final byte[] value) { this.edmType = EdmType.BINARY; this.type = byte[].class; this.value = value == null ? null : Base64.encode(value); }
/** * Exports the value of the access key to a Base64-encoded string. * * @return A <code>String</code> that represents the Base64-encoded access key. */ public String exportBase64EncodedKey() { return Base64.encode(this.key); }
/** * Sets this {@link EntityProperty} using the serialized <code>byte[]</code> value. * * @param value * The <code>byte[]</code> value to set as the {@link EntityProperty} value. This value may be * <code>null</code>. */ public synchronized final void setValue(final byte[] value) { this.edmType = EdmType.BINARY; this.type = byte[].class; this.value = value == null ? null : Base64.encode(value); }
/** * Exports the value of the access key to a Base64-encoded string. * * @return A <code>String</code> that represents the Base64-encoded access key. */ public String exportBase64EncodedKey() { return Base64.encode(this.key); }
/** * @return the md5 */ public String getMd5() { if (this.streamMd5 == null && this.intermediateMD5 != null) { this.streamMd5 = Base64.encode(this.intermediateMD5.digest()); } return this.streamMd5; }
/** * @return the md5 */ public String getMd5() { if (this.streamMd5 == null && this.intermediateMD5 != null) { this.streamMd5 = Base64.encode(this.intermediateMD5.digest()); } return this.streamMd5; }
public BlobBlock(InputStream blockStream) { this(Base64.encode(UUID.randomUUID().toString().getBytes()), blockStream); }
/** * Sets the content of the message as a <code>byte</code> array. * * @param content * A <code>byte</code> array which contains the content of the message. */ public final void setMessageContent(final byte[] content) { Utility.assertNotNull("content", content); this.messageContent = Base64.encode(content); this.messageType = QueueMessageType.BASE_64_ENCODED; }
/** * Generates a new block ID to be used for PutBlock. * * @return Base64 encoded block ID * @throws IOException */ private String getCurrentBlockId() throws IOException { String blockIdSuffix = String.format("%06d", this.blockList.size()); byte[] blockIdInBytes; try { blockIdInBytes = (this.blockIdPrefix + blockIdSuffix).getBytes(Constants.UTF8_CHARSET); } catch (UnsupportedEncodingException e) { // this should never happen, UTF8 is a default charset throw new IOException(e); } return Base64.encode(blockIdInBytes); }
/** * Sets the content of the message as a <code>byte</code> array. * * @param content * A <code>byte</code> array which contains the content of the message. */ public final void setMessageContent(final byte[] content) { Utility.assertNotNull("content", content); this.messageContent = Base64.encode(content); this.messageType = QueueMessageType.BASE_64_ENCODED; }
/** * Generates a new block ID to be used for PutBlock. * * @return Base64 encoded block ID * @throws IOException */ private String getCurrentBlockId() throws IOException { String blockIdSuffix = String.format("%06d", this.blockList.size()); byte[] blockIdInBytes; try { blockIdInBytes = (this.blockIdPrefix + blockIdSuffix).getBytes(Constants.UTF8_CHARSET); } catch (UnsupportedEncodingException e) { // this should never happen, UTF8 is a default charset throw new IOException(e); } return Base64.encode(blockIdInBytes); }
/** * Sets the mock account key in the given configuration. * * @param conf * The configuration. */ public static void setMockAccountKey(Configuration conf, String accountName) { conf.set(ACCOUNT_KEY_PROPERTY_NAME + accountName, Base64.encode(new byte[] { 1, 2, 3 })); }
/** * Sets the mock account key in the given configuration. * * @param conf * The configuration. */ public static void setMockAccountKey(Configuration conf, String accountName) { conf.set(ACCOUNT_KEY_PROPERTY_NAME + accountName, Base64.encode(new byte[] { 1, 2, 3 })); }
/** * Commits the file. * * @throws StorageException * An exception representing any error which occurred during the operation. * @throws URISyntaxException */ @DoesServiceRequest private void commit() throws StorageException, URISyntaxException { if (this.options.getStoreFileContentMD5()) { this.parentFileRef.getProperties().setContentMD5(Base64.encode(this.md5Digest.digest())); } this.parentFileRef.uploadProperties(this.accessCondition, this.options, this.opContext); }
/** * Commits the file. * * @throws StorageException * An exception representing any error which occurred during the operation. * @throws URISyntaxException */ @DoesServiceRequest private void commit() throws StorageException, URISyntaxException { if (this.options.getStoreFileContentMD5()) { this.parentFileRef.getProperties().setContentMD5(Base64.encode(this.md5Digest.digest())); } this.parentFileRef.uploadProperties(this.accessCondition, this.options, this.opContext); }
/** * Commits the blob, for block blob this uploads the block list. * * @throws StorageException * An exception representing any error which occurred during the operation. */ @DoesServiceRequest private synchronized void commit() throws StorageException { if (this.options.getStoreBlobContentMD5()) { this.parentBlobRef.getProperties().setContentMD5(Base64.encode(this.md5Digest.digest())); } if (this.streamType == BlobType.BLOCK_BLOB) { // wait for all blocks to finish final CloudBlockBlob blobRef = (CloudBlockBlob) this.parentBlobRef; blobRef.commitBlockList(this.blockList, this.accessCondition, this.options, this.opContext); } else if (this.options.getStoreBlobContentMD5()) { this.parentBlobRef.uploadProperties(this.accessCondition, this.options, this.opContext); } }
@Test public void testStorageCredentialsSharedKeyUpdateKey() throws URISyntaxException, StorageException { StorageCredentialsAccountAndKey cred = new StorageCredentialsAccountAndKey(ACCOUNT_NAME, ACCOUNT_KEY); assertEquals(ACCOUNT_KEY, cred.exportBase64EncodedKey()); // Validate update with byte array byte[] dummyKey = { 0, 1, 2 }; cred.updateKey(dummyKey); String base64EncodedDummyKey = Base64.encode(dummyKey); assertEquals(base64EncodedDummyKey, cred.exportBase64EncodedKey()); // Validate update with string dummyKey[0] = 3; base64EncodedDummyKey = Base64.encode(dummyKey); cred.updateKey(base64EncodedDummyKey); assertEquals(base64EncodedDummyKey, cred.exportBase64EncodedKey()); }
@Test public void testStorageCredentialsSharedKey() throws URISyntaxException, StorageException { StorageCredentialsAccountAndKey cred = new StorageCredentialsAccountAndKey(ACCOUNT_NAME, ACCOUNT_KEY); assertEquals(ACCOUNT_NAME, cred.getAccountName()); URI testUri = new URI("http://test/abc?querya=1"); assertEquals(testUri, cred.transformUri(testUri)); assertEquals(ACCOUNT_KEY, cred.exportBase64EncodedKey()); byte[] dummyKey = { 0, 1, 2 }; String base64EncodedDummyKey = Base64.encode(dummyKey); cred = new StorageCredentialsAccountAndKey(ACCOUNT_NAME, base64EncodedDummyKey); assertEquals(base64EncodedDummyKey, cred.exportBase64EncodedKey()); dummyKey[0] = 3; base64EncodedDummyKey = Base64.encode(dummyKey); cred = new StorageCredentialsAccountAndKey(ACCOUNT_NAME, base64EncodedDummyKey); assertEquals(base64EncodedDummyKey, cred.exportBase64EncodedKey()); }