Package com.amazonaws.services.s3.internal

Examples of com.amazonaws.services.s3.internal.InputSubstream


        if (putObjectRequest.getInputStream() != null) {
            request = new UploadPartRequest()
                .withBucketName(bucketName)
                .withKey(key)
                .withUploadId(uploadId)
                .withInputStream(new InputSubstream(putObjectRequest.getInputStream(), 0, partSize, isLastPart))
                .withPartNumber(partNumber++)
                .withPartSize(partSize);
        } else {
            request = new UploadPartRequest()
                .withBucketName(bucketName)
View Full Code Here


    public static InputStream getEncryptedInputStream(UploadPartRequest request, Cipher symmetricCipher) {
      try {
        InputStream originalInputStream = request.getInputStream();
        if (request.getFile() != null) {
                originalInputStream = new InputSubstream(new RepeatableFileInputStream(request.getFile()),
                        request.getFileOffset(), request.getPartSize(), request.isLastPart());
        }

        originalInputStream = new CipherInputStream(originalInputStream, symmetricCipher);

        if (request.isLastPart() == false) {
          // We want to prevent the final padding from being sent on the stream...
          originalInputStream = new InputSubstream(originalInputStream, 0, request.getPartSize(), false);
        }

        long partSize = request.getPartSize();
        int cipherBlockSize = symmetricCipher.getBlockSize();
        return new ByteRangeCapturingInputStream(originalInputStream, partSize - cipherBlockSize, partSize);
View Full Code Here

        InputStream inputStream = null;
        if (uploadPartRequest.getInputStream() != null) {
            inputStream = uploadPartRequest.getInputStream();
        } else if (uploadPartRequest.getFile() != null) {
            try {
                inputStream = new InputSubstream(new RepeatableFileInputStream(uploadPartRequest.getFile()),
                        uploadPartRequest.getFileOffset(), partSize, true);
            } catch (FileNotFoundException e) {
                throw new IllegalArgumentException("The specified file doesn't exist", e);
            }
        } else {
View Full Code Here

                Exception failedException = null;
                boolean completed = false;
                int tries = 0;
                    while (!completed && tries < 5){
                        tries++;
                        InputSubstream inputSubStream = null;
                        try {
                            inputSubStream = new InputSubstream(
                                    newResettableInputStream(file, fileNotFoundMsg)
                                        .disableClose(), // requires explicit release
                                    currentPosition, length, true);
                                inputSubStream.mark(-1);
                            String checksum = TreeHashGenerator.calculateTreeHash(inputSubStream);
                            byte[] binaryChecksum = BinaryUtils.fromHex(checksum);
                            inputSubStream.reset();
                            UploadMultipartPartRequest req = new UploadMultipartPartRequest()
                                .withAccountId(accountId)
                                .withChecksum(checksum)
                                .withBody(inputSubStream)
                                .withRange("bytes " + currentPosition + "-" + (currentPosition + length - 1) + "/*")
 
View Full Code Here

        if (putObjectRequest.getInputStream() != null) {
            request = new UploadPartRequest()
                .withBucketName(bucketName)
                .withKey(key)
                .withUploadId(uploadId)
                .withInputStream(new InputSubstream(putObjectRequest.getInputStream(), 0, partSize, isLastPart))
                .withPartNumber(partNumber++)
                .withPartSize(partSize);
        } else {
            request = new UploadPartRequest()
                .withBucketName(bucketName)
View Full Code Here

        InputStream inputStream = null;
        if (uploadPartRequest.getInputStream() != null) {
            inputStream = uploadPartRequest.getInputStream();
        } else if (uploadPartRequest.getFile() != null) {
            try {
                inputStream = new InputSubstream(new RepeatableFileInputStream(uploadPartRequest.getFile()),
                        uploadPartRequest.getFileOffset(), partSize, true);
            } catch (FileNotFoundException e) {
                throw new IllegalArgumentException("The specified file doesn't exist", e);
            }
        } else {
View Full Code Here

    public static InputStream getEncryptedInputStream(UploadPartRequest request, Cipher symmetricCipher) {
      try {
        InputStream originalInputStream = request.getInputStream();
        if (request.getFile() != null) {
                originalInputStream = new InputSubstream(new RepeatableFileInputStream(request.getFile()),
                        request.getFileOffset(), request.getPartSize());
        }

        originalInputStream = new CipherInputStream(originalInputStream, symmetricCipher);

        if (request.isLastPart() == false) {
          // We want to prevent the final padding from being sent on the stream...
          originalInputStream = new InputSubstream(originalInputStream, 0, request.getPartSize());
        }

        long partSize = request.getPartSize();
        int cipherBlockSize = symmetricCipher.getBlockSize();
        return new ByteRangeCapturingInputStream(originalInputStream, partSize - cipherBlockSize, partSize);
View Full Code Here

        InputStream inputStream = null;
        if (uploadPartRequest.getInputStream() != null) {
            inputStream = uploadPartRequest.getInputStream();
        } else if (uploadPartRequest.getFile() != null) {
            try {
                inputStream = new InputSubstream(new RepeatableFileInputStream(uploadPartRequest.getFile()),
                        uploadPartRequest.getFileOffset(), partSize);
            } catch (FileNotFoundException e) {
                throw new IllegalArgumentException("The specified file doesn't exist", e);
            }
        } else {
View Full Code Here

        return partSize;
    }

    private InputSubstream newInputSubstream(File file, long startingPosition, long length) {
        try {
            return new InputSubstream(new RepeatableFileInputStream(file), startingPosition, length, true);
        } catch (FileNotFoundException e) {
            throw new AmazonClientException("Unable to find file '" + file.getAbsolutePath() + "'", e);
        }
    }
View Full Code Here

    }


    private InputSubstream newInputSubstream(File file, long startingPosition, long length) {
        try {
            return new InputSubstream(new RepeatableFileInputStream(file), startingPosition, length, true);
        } catch (FileNotFoundException e) {
            throw new AmazonClientException("Unable to find file '" + file.getAbsolutePath() + "'", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.s3.internal.InputSubstream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.