Class AbstractAwsInputStream

java.lang.Object
java.io.InputStream
com.adobe.testing.s3mock.util.AbstractAwsInputStream
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
AwsChunkedDecodingChecksumInputStream, AwsUnsignedChunkedDecodingChecksumInputStream

public abstract class AbstractAwsInputStream extends InputStream
  • Field Details

    • CRLF

      protected static final byte[] CRLF
    • DELIMITER

      protected static final byte[] DELIMITER
    • CHECKSUM_HEADER

      protected static final byte[] CHECKSUM_HEADER
    • readDecodedLength

      protected long readDecodedLength
    • source

      protected final InputStream source
    • chunkLength

      protected long chunkLength
    • checksum

      protected String checksum
    • algorithm

      protected ChecksumAlgorithm algorithm
    • chunks

      protected int chunks
    • decodedLength

      protected final long decodedLength
  • Constructor Details

    • AbstractAwsInputStream

      protected AbstractAwsInputStream(InputStream source, long decodedLength)
  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException
    • readUntil

      protected byte[] readUntil(byte[] endSequence) throws IOException
      Reads this stream until the byte sequence was found.
      Parameters:
      endSequence - The byte sequence to look for in the stream. The source stream is read until the last bytes read are equal to this sequence.
      Returns:
      The bytes read before the end sequence started.
      Throws:
      IOException
    • endsWith

      protected boolean endsWith(ByteBuffer buffer, byte[] endSequence)
    • setChunkLength

      protected void setChunkLength(byte[] hexLengthBytes)
    • extractAlgorithmAndChecksum

      protected void extractAlgorithmAndChecksum() throws IOException
      Throws:
      IOException
    • getChecksum

      public String getChecksum()
    • getAlgorithm

      public ChecksumAlgorithm getAlgorithm()