Examples of ResettableInputStream


Examples of com.amazonaws.internal.ResettableInputStream

                // in the lower stack frames
                isCurr = ReleasableInputStream.wrap(isOrig).disableClose();
            } else {
                try {
                    // requires explicit release
                    isCurr = new ResettableInputStream(fileOrig).disableClose();
                } catch(IOException e) {
                    throw new IllegalArgumentException("Failed to open file "
                            + fileOrig, 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

            // 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

    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)
            .disableClose(); // requires explicit release
        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

                    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

                    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 org.apache.flume.serialization.ResettableInputStream

    mini = sb.toString();
  }

  @Test
  public void testSimple() throws IOException {
    ResettableInputStream in = new ResettableTestStringInputStream(mini);
    EventDeserializer des = new BlobDeserializer(new Context(), in);
    validateMiniParse(des);
  }
View Full Code Here

Examples of org.apache.flume.serialization.ResettableInputStream

    validateMiniParse(des);
  }

  @Test
  public void testSimpleViaBuilder() throws IOException {
    ResettableInputStream in = new ResettableTestStringInputStream(mini);
    EventDeserializer.Builder builder = new BlobDeserializer.Builder();
    EventDeserializer des = builder.build(new Context(), in);
    validateMiniParse(des);
  }
View Full Code Here

Examples of org.apache.flume.serialization.ResettableInputStream

    validateMiniParse(des);
  }

  @Test
  public void testSimpleViaFactory() throws IOException {
    ResettableInputStream in = new ResettableTestStringInputStream(mini);
    EventDeserializer des;
    des = EventDeserializerFactory.getInstance(BlobDeserializer.Builder.class.getName(), new Context(), in);
    validateMiniParse(des);
  }
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.