@Override public void signRequest(HttpURLConnection connection, ServiceClient client, OperationContext context) throws Exception { if (signAsTable) { StorageRequest.signTableRequest(connection, client, descriptor.getLength(), context); } else { StorageRequest.signBlobQueueAndFileRequest(connection, client, descriptor.getLength(), context); } }
@Override public void signRequest(HttpURLConnection connection, ServiceClient client, OperationContext context) throws Exception { if (signAsTable) { StorageRequest.signTableRequest(connection, client, descriptor.getLength(), context); } else { StorageRequest.signBlobQueueAndFileRequest(connection, client, descriptor.getLength(), context); } }
final byte[] retrievedBuff = new byte[Constants.BUFFER_COPY_LENGTH]; int nextCopy = (int) Math.min(retrievedBuff.length, writeLength - retVal.getLength()); count = sourceStream.read(retrievedBuff, 0, nextCopy); digest.update(retrievedBuff, 0, count); retVal.setLength(retVal.getLength() + count); if (retVal.getLength() > abandonLength) { nextCopy = (int) Math.min(retrievedBuff.length, writeLength - retVal.getLength()); count = sourceStream.read(retrievedBuff, 0, nextCopy); if (retVal.getLength() != -1 && calculateMD5) { retVal.setMd5(Base64.encode(digest.digest())); if (retVal.getLength() != -1 && writeLength > 0) { retVal.setLength(Math.min(retVal.getLength(), writeLength));
@Override public void validateStreamWrite(StreamMd5AndLength descriptor) throws StorageException { if (this.getLength() != null && this.getLength() != -1) { if (length != descriptor.getLength()) { throw new StorageException(StorageErrorCodeStrings.INVALID_INPUT, SR.INCORRECT_STREAM_LENGTH, HttpURLConnection.HTTP_FORBIDDEN, null, null); } } } };
final byte[] retrievedBuff = new byte[Constants.BUFFER_COPY_LENGTH]; int nextCopy = (int) Math.min(retrievedBuff.length, writeLength - retVal.getLength()); count = sourceStream.read(retrievedBuff, 0, nextCopy); digest.update(retrievedBuff, 0, count); retVal.setLength(retVal.getLength() + count); if (retVal.getLength() > abandonLength) { nextCopy = (int) Math.min(retrievedBuff.length, writeLength - retVal.getLength()); count = sourceStream.read(retrievedBuff, 0, nextCopy); if (retVal.getLength() != -1 && calculateMD5) { retVal.setMd5(Base64.encode(digest.digest())); if (retVal.getLength() != -1 && writeLength > 0) { retVal.setLength(Math.min(retVal.getLength(), writeLength));
@Override public void validateStreamWrite(StreamMd5AndLength descriptor) throws StorageException { if (this.getLength() != null && this.getLength() != -1) { if (length != descriptor.getLength()) { throw new StorageException(StorageErrorCodeStrings.INVALID_INPUT, SR.INCORRECT_STREAM_LENGTH, HttpURLConnection.HTTP_FORBIDDEN, null, null); } } } };
@Override public HttpURLConnection buildRequest(ServiceClient client, Void parentObject, OperationContext context) throws Exception { this.setSendStream(sendStream); this.setLength(descriptor.getLength()); return BaseRequest.setServiceProperties( credentials.transformUri(client.getEndpoint()), options, null, context); }
@Override public HttpURLConnection buildRequest(ServiceClient client, Void parentObject, OperationContext context) throws Exception { this.setSendStream(sendStream); this.setLength(descriptor.getLength()); return BaseRequest.setServiceProperties( credentials.transformUri(client.getEndpoint()), options, null, context); }
@Override public HttpURLConnection buildRequest(CloudBlobClient client, CloudBlob blob, OperationContext context) throws Exception { this.setSendStream(blockListInputStream); this.setLength(descriptor.getLength()); return BlobRequest.putBlockList( blob.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition, blob.properties); }
@Override public HttpURLConnection buildRequest(CloudBlobClient client, CloudBlob blob, OperationContext context) throws Exception { this.setSendStream(blockListInputStream); this.setLength(descriptor.getLength()); return BlobRequest.putBlockList( blob.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition, blob.properties); }
if (descriptor.getLength() > 4 * Constants.MB) { throw new IllegalArgumentException(SR.STREAM_LENGTH_GREATER_THAN_4MB); descriptor.getLength(), accessCondition, options, opContext); return ExecutionEngine.executeWithRetry(this.blobServiceClient, this, appendBlockImpl, options.getRetryPolicyFactory(), opContext);
if (descriptor.getLength() > 4 * Constants.MB) { throw new IllegalArgumentException(SR.STREAM_LENGTH_GREATER_THAN_4MB); descriptor.getLength(), accessCondition, options, opContext); return ExecutionEngine.executeWithRetry(this.blobServiceClient, this, appendBlockImpl, options.getRetryPolicyFactory(), opContext);
boolean skipPutBlob = !inputDataStream.markSupported() || descriptor.getLength() > options.getSingleBlobPutThresholdInBytes(); long byteCount = Utility.encryptStreamIfUnderThreshold(inputDataStream, targetStream, cipher, descriptor.getLength(), options.getSingleBlobPutThresholdInBytes() + 1 /*abandon if the operation hits this limit*/); if (!skipPutBlob && (descriptor.getLength() < 0 || options.getStoreBlobContentMD5())) { descriptor = Utility.analyzeStream(inputDataStream, descriptor.getLength(), options.getSingleBlobPutThresholdInBytes() + 1 /*abandon if the operation hits this limit*/, true /* rewindSourceStream */, options.getStoreBlobContentMD5()); if (descriptor.getLength() == -1 || descriptor.getLength() > options.getSingleBlobPutThresholdInBytes()) this.uploadFullBlob(inputDataStream, descriptor.getLength(), accessCondition, options, opContext); || this.streamWriteSizeInBytes < Constants.MIN_LARGE_BLOCK_SIZE || options.getStoreBlobContentMD5() || descriptor.getLength() == -1;