Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2013-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   *
   *  http://aws.amazon.com/apache2.0
   *
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.s3.internal.crypto;
 
 
 
     private final ContentCryptoMaterial cekMaterial;
    
Can be used to enforce serial uploads.
 
     @GuardedBy("this")
     private int partNumber;
    
True if a multi-part upload is currently in progress; false otherwise.
 
     private volatile boolean partUploadInProgress;
 
     MultipartUploadCryptoContext(String bucketNameString key,
             ContentCryptoMaterial cekMaterial) {
         super(bucketNamekey);
         this. = cekMaterial;
     }

    
Convenient method to return the content encrypting cipher lite (which is stateful) for the multi-part uploads.
 
     CipherLite getCipherLite() {
         return .getCipherLite();
     }

    
Returns the content encrypting cryptographic material for the multi-part uploads.
 
         return ;
     }

    
Can be used to check the next part number must either be the same (if it was an retry) or increment by exactly 1 during a serial part uploads.

As a side effect, the partUploadInProgress will be set to true upon successful completion of this method. Caller of this method is responsible to call endPartUpload() in a finally block once the respective part-upload is completed (either normally or abruptly).

Throws:
com.amazonaws.AmazonClientException if parallel part upload is detected
See also:
endPartUpload()
 
     void beginPartUpload(final int nextPartNumber)
             throws AmazonClientException {
         if (nextPartNumber < 1)
             throw new IllegalArgumentException("part number must be at least 1");
         if () {
             throw new AmazonClientException(
                     "Parts are required to be uploaded in series");
         }
         synchronized (this) {
             if (nextPartNumber -  <= 1) {
                  = nextPartNumber;
                  = true;
             } else {
                 throw new AmazonClientException(
                         "Parts are required to be uploaded in series (partNumber="
                                 +  + ", nextPartNumber="
                                 + nextPartNumber + ")");
             }
         }
     }

    
Used to mark the completion of a part upload before the next. Should be invoked in a finally block, and must be preceded previously by a call to beginPartUpload(int).

 
     void endPartUpload() {
          = false;
     }
New to GrepCode? Check out our FAQ X