Class CipherInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable, software.amazon.awssdk.core.internal.io.Releasable
    Direct Known Subclasses:
    AuthenticatedCipherInputStream

    public class CipherInputStream
    extends software.amazon.awssdk.core.io.SdkFilterInputStream
    A cipher stream for encrypting or decrypting data using an unauthenticated block cipher.
    • Field Detail

      • cipher

        protected final Cipher cipher
      • eofReached

        protected boolean eofReached
      • inputBuffer

        protected byte[] inputBuffer
      • outputBuffer

        protected byte[] outputBuffer
      • currentPosition

        protected int currentPosition
      • maxPosition

        protected int maxPosition
    • Constructor Detail

      • CipherInputStream

        public CipherInputStream​(InputStream inputStream,
                                 Cipher cipher)
    • Method Detail

      • read

        public int read()
                 throws IOException
        Overrides:
        read in class software.amazon.awssdk.core.io.SdkFilterInputStream
        Throws:
        IOException
      • read

        public int read​(byte[] buffer,
                        int off,
                        int targetLength)
                 throws IOException
        Overrides:
        read in class software.amazon.awssdk.core.io.SdkFilterInputStream
        Throws:
        IOException
      • skip

        public long skip​(long n)

        Note: This implementation will only skip up to the end of the buffered data, potentially skipping 0 bytes.

        Overrides:
        skip in class software.amazon.awssdk.core.io.SdkFilterInputStream
      • available

        public int available()
        Overrides:
        available in class software.amazon.awssdk.core.io.SdkFilterInputStream
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class software.amazon.awssdk.core.io.SdkFilterInputStream
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class software.amazon.awssdk.core.io.SdkFilterInputStream
      • reset

        public void reset()
                   throws IOException
        Overrides:
        reset in class software.amazon.awssdk.core.io.SdkFilterInputStream
        Throws:
        IOException
      • nextChunk

        protected int nextChunk()
                         throws IOException
        Reads and process the next chunk of data into memory.
        Returns:
        the length of the data chunk read and processed, or -1 if end of stream.
        Throws:
        IOException - if there is an IO exception from the underlying input stream
      • endOfFileReached

        protected int endOfFileReached()