Tabnine Logo
MD5DigestCalculatingInputStream
Code IndexAdd Tabnine to your IDE (free)

How to use
MD5DigestCalculatingInputStream
in
com.amazonaws.services.s3.internal

Best Java code snippets using com.amazonaws.services.s3.internal.MD5DigestCalculatingInputStream (Showing top 20 results out of 315)

origin: aws/aws-sdk-java

@Override
public void mark(int readlimit) {
  if (markSupported()) {
    super.mark(readlimit);
    digestLastMarked = cloneFrom(digest);
  }
}
origin: aws/aws-sdk-java

private void resetDigest() {
  try {
    digest = MessageDigest.getInstance("MD5");
  } catch (NoSuchAlgorithmException e) {
    throw new IllegalStateException("No message digest support for MD5 was found.", e);
  }
  digestCanBeCloned = canBeCloned(digest);
}
origin: aws/aws-sdk-java

/**
 * Resets the wrapped input stream and the in progress message digest.
 */
@Override
public void reset() throws IOException {
  if (markSupported()) {
    super.reset();
    if (digestLastMarked == null) {
      resetDigest();
    } else {
      digest = cloneFrom(digestLastMarked);
    }
  } else {
    throw new IOException("mark/reset not supported");
  }
}
origin: aws/aws-sdk-java

  input = md5DigestStream = new MD5DigestCalculatingInputStream(input);
contentMd5 = Base64.encodeAsString(md5DigestStream.getMd5Digest());
origin: aws-amplify/aws-sdk-android

MD5DigestCalculatingInputStream is = new MD5DigestCalculatingInputStream(
    new ByteArrayInputStream(data));
baExpected = IOUtils.toByteArray(is);
byte[] md5 = is.getMd5Digest();
assertTrue(Arrays.equals(md5Expected, md5));
MD5DigestCalculatingInputStream is = new MD5DigestCalculatingInputStream(
    new ByteArrayInputStream(data));
is.mark(-1);
baExpected = IOUtils.toByteArray(is);
byte[] md5 = is.getMd5Digest();
assertTrue(Arrays.equals(md5Expected, md5));
is.reset();
byte[] ba = IOUtils.toByteArray(is);
byte[] md5_2 = is.getMd5Digest();
assertTrue(Arrays.equals(md5Expected, md5_2));
assertTrue(Arrays.equals(baExpected, ba));
MD5DigestCalculatingInputStream is = new MD5DigestCalculatingInputStream(
    new ByteArrayInputStream(data));
is.mark(-1);
is.read(new byte[10]);
is.reset();
byte[] ba = IOUtils.toByteArray(is);
if (DEBUG)
  System.out.println("ba.length: " + ba.length);
assertTrue(Arrays.equals(baExpected, ba));
byte[] md5 = is.getMd5Digest();
origin: aws-amplify/aws-sdk-android

/**
 * Resets the wrapped input stream and the in progress message digest.
 */
@Override
public void reset() throws IOException {
  if (markSupported()) {
    super.reset();
    digest = (digestLastMarked == null)
        // This is necessary so that should there be a reset without a
        // preceding mark, the MD5 would still be computed correctly.
        ? newMD5()
        : cloneFrom(digestLastMarked);
  } else {
    throw new IOException("mark/reset not supported");
  }
}
origin: aws/aws-sdk-java

byte[] clientSideHash = md5DigestStream.getMd5Digest();
byte[] serverSideHash = BinaryUtils.fromHex(etag);
origin: aws/aws-sdk-java

isCurr = md5DigestStream = new MD5DigestCalculatingInputStream(isCurr);
origin: aws/aws-sdk-java

public MD5DigestCalculatingInputStream(InputStream in) {
  super(in);
  resetDigest();
  if (in.markSupported() && !digestCanBeCloned) {
    log.debug("Mark-and-reset disabled on MD5 calculation because the digest implementation does not support cloning. "
         + "This will limit the SDK's ability to retry requests that failed. Consider pre-calculating the MD5 "
         + "checksum for the request or switching to a security provider that supports message digest cloning.");
  }
}
origin: aws-amplify/aws-sdk-android

/**
 * Constructor.
 * @param in input stream
 */
public MD5DigestCalculatingInputStream(InputStream in) {
  super(in);
  digest = newMD5();
}
origin: aws-amplify/aws-sdk-android

inputStream = md5DigestStream = new MD5DigestCalculatingInputStream(inputStream);
  final byte[] clientSideHash = md5DigestStream.getMd5Digest();
  final byte[] serverSideHash = BinaryUtils.fromHex(metadata.getETag());
origin: com.amazonaws/aws-android-sdk-s3

/**
 * Resets the wrapped input stream and the in progress message digest.
 */
@Override
public void reset() throws IOException {
  if (markSupported()) {
    super.reset();
    digest = (digestLastMarked == null)
        // This is necessary so that should there be a reset without a
        // preceding mark, the MD5 would still be computed correctly.
        ? newMD5()
        : cloneFrom(digestLastMarked);
  } else {
    throw new IOException("mark/reset not supported");
  }
}
origin: Nextdoor/bender

byte[] clientSideHash = md5DigestStream.getMd5Digest();
byte[] serverSideHash = BinaryUtils.fromHex(etag);
origin: Nextdoor/bender

isCurr = md5DigestStream = new MD5DigestCalculatingInputStream(isCurr);
origin: Nextdoor/bender

public MD5DigestCalculatingInputStream(InputStream in) {
  super(in);
  resetDigest();
  if (in.markSupported() && !digestCanBeCloned) {
    log.debug("Mark-and-reset disabled on MD5 calculation because the digest implementation does not support cloning. "
         + "This will limit the SDK's ability to retry requests that failed. Consider pre-calculating the MD5 "
         + "checksum for the request or switching to a security provider that supports message digest cloning.");
  }
}
origin: com.amazonaws/aws-android-sdk-s3

/**
 * Constructor.
 * @param in input stream
 */
public MD5DigestCalculatingInputStream(InputStream in) {
  super(in);
  digest = newMD5();
}
origin: aws-amplify/aws-sdk-android

input = md5DigestStream = new MD5DigestCalculatingInputStream(input);
contentMd5 = BinaryUtils.toBase64(md5DigestStream.getMd5Digest());
origin: aws-amplify/aws-sdk-android

@Override
public void mark(int readlimit) {
  if (markSupported()) {
    super.mark(readlimit);
    digestLastMarked = cloneFrom(digest);
  }
}
origin: Nextdoor/bender

/**
 * Resets the wrapped input stream and the in progress message digest.
 */
@Override
public void reset() throws IOException {
  if (markSupported()) {
    super.reset();
    if (digestLastMarked == null) {
      resetDigest();
    } else {
      digest = cloneFrom(digestLastMarked);
    }
  } else {
    throw new IOException("mark/reset not supported");
  }
}
origin: Nextdoor/bender

private void resetDigest() {
  try {
    digest = MessageDigest.getInstance("MD5");
  } catch (NoSuchAlgorithmException e) {
    throw new IllegalStateException("No message digest support for MD5 was found.", e);
  }
  digestCanBeCloned = canBeCloned(digest);
}
com.amazonaws.services.s3.internalMD5DigestCalculatingInputStream

Javadoc

Simple InputStream wrapper that examines the wrapped stream's contents as they are read and calculates and MD5 digest.

Most used methods

  • <init>
    Constructor.
  • getMd5Digest
  • cloneFrom
  • markSupported
  • canBeCloned
  • newMD5
  • resetDigest
  • mark
  • read
  • reset
    Resets the wrapped input stream and the in progress message digest.

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now