Examples of ResettableInputStream


Examples of com.amazonaws.internal.ResettableInputStream

            // mark-and-resettable for signing and retry purposes.
            if (content instanceof FileInputStream) {
                try {
                    // ResettableInputStream supports mark-and-reset without
                    // memory buffering
                    content = new ResettableInputStream((FileInputStream)content);
                } catch (IOException e) {
                    if (log.isDebugEnabled())
                        log.debug("For the record; ignore otherwise", e);
                }
            }
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

            // mark-and-resettable for signing and retry purposes.
            if (content instanceof FileInputStream) {
                try {
                    // ResettableInputStream supports mark-and-reset without
                    // memory buffering
                    content = new ResettableInputStream((FileInputStream)content);
                } catch (IOException e) {
                    if (log.isDebugEnabled())
                        log.debug("For the record; ignore otherwise", e);
                }
            }
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

                    awsreq.getRequestClientOptions()
                        .setReadLimit(bufsize.intValue());
                }
            } else {
                try {
                    isCurr = new ResettableInputStream(fileOrig);
                } catch(IOException e) {
                    throw new IllegalArgumentException("Failed to open file "
                            + fileOrig, e);
                }
            }
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

                    throw new IllegalArgumentException(
                        "A File or InputStream must be specified when uploading part");
                }
                isCurr = isOrig;
            } else {
                isCurr = new ResettableInputStream(fileOrig);
            }
            isCurr = new InputSubstream(isCurr,
                    req.getFileOffset(),
                    req.getPartSize(),
                    req.isLastPart());
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

        InputStream isCurr = null;
        try {
            if (fileOrig == null) {
                isCurr = isOrig;
            } else {
                isCurr = new ResettableInputStream(fileOrig);
            }
            if (plaintextLength > -1) {
                // S3 allows a single PUT to be no more than 5GB, which
                // therefore won't exceed the maximum length that can be
                // encrypted either using any cipher such as CBC or GCM.
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

    private UploadResult uploadInSinglePart(final String accountId,
            final String vaultName, final String archiveDescription,
            final File file, ProgressListener progressListener) {
        String checksum = TreeHashGenerator.calculateTreeHash(file);
        ResettableInputStream is = newResettableInputStream(file);
        try {
            publishProgress(progressListener, ProgressEventType.TRANSFER_STARTED_EVENT);
            final UploadArchiveRequest req = new UploadArchiveRequest()
                .withAccountId(accountId)
                .withArchiveDescription(archiveDescription)
                .withVaultName(vaultName)
                .withChecksum(checksum)
                .withBody(is)
                .withContentLength(file.length())
                // capture the bytes transferred
                .withGeneralProgressListener(progressListener)
                ;
            UploadArchiveResult uploadArchiveResult = glacier.uploadArchive(req);
            String artifactId = uploadArchiveResult.getArchiveId();
            publishProgress(progressListener, ProgressEventType.TRANSFER_COMPLETED_EVENT);
            return new UploadResult(artifactId);
        } catch (Throwable t) {
            publishProgress(progressListener, ProgressEventType.TRANSFER_FAILED_EVENT);
            throw failure(t);
        } finally {
            is.release();
        }
    }
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

   *             If any problems were encountered reading the data or
   *             computing the hash.
   */
    public static String calculateTreeHash(File file)
            throws AmazonClientException {
        ResettableInputStream is = null;
        try {
            is = new ResettableInputStream(file);
            return calculateTreeHash(is);
        } catch (IOException e) {
            throw new AmazonClientException("Unable to compute hash for file: "
                    + file.getAbsolutePath(), e);
        } finally {
            if (is != null)
                is.release();
        }
    }
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

            // mark-and-resettable for signing and retry purposes.
            if (content instanceof FileInputStream) {
                try {
                    // ResettableInputStream supports mark-and-reset without
                    // memory buffering
                    content = new ResettableInputStream((FileInputStream)content);
                } catch (IOException e) {
                    if (log.isDebugEnabled())
                        log.debug("For the record; ignore otherwise", e);
                }
            }
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

                        "A File or InputStream must be specified when uploading part");
                }
                isCurr = ReleasableInputStream.wrap(isOrig).disableClose();
            } else {
                // requires explicit release
                isCurr = new ResettableInputStream(fileOrig).disableClose();
            }
            isCurr = new InputSubstream(isCurr,
                    req.getFileOffset(),
                    req.getPartSize(),
                    req.isLastPart());
View Full Code Here

Examples of com.amazonaws.internal.ResettableInputStream

        InputStream isCurr = null;
        try {
            if (fileOrig == null) {
                isCurr = isOrig;
            } else {
                isCurr = new ResettableInputStream(fileOrig)
                            .disableClose();    // requires explicit release
            }
            if (plaintextLength > -1) {
                // S3 allows a single PUT to be no more than 5GB, which
                // therefore won't exceed the maximum length that can be
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.