Class CipherInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- software.amazon.awssdk.core.io.SdkFilterInputStream
-
- software.amazon.encryption.s3.internal.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.SdkFilterInputStreamA cipher stream for encrypting or decrypting data using an unauthenticated block cipher.
-
-
Field Summary
Fields Modifier and Type Field Description protected Ciphercipherprotected intcurrentPositionprotected booleaneofReachedprotected byte[]inputBufferprotected intmaxPositionprotected byte[]outputBuffer-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description CipherInputStream(InputStream inputStream, Cipher cipher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()protected intendOfFileReached()voidmark(int readlimit)booleanmarkSupported()protected intnextChunk()Reads and process the next chunk of data into memory.intread()intread(byte[] buffer)intread(byte[] buffer, int off, int targetLength)voidreset()longskip(long n)
-
-
-
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:
readin classsoftware.amazon.awssdk.core.io.SdkFilterInputStream- Throws:
IOException
-
read
public int read(byte[] buffer) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] buffer, int off, int targetLength) throws IOException- Overrides:
readin classsoftware.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:
skipin classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
available
public int available()
- Overrides:
availablein classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classsoftware.amazon.awssdk.core.io.SdkFilterInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classsoftware.amazon.awssdk.core.io.SdkFilterInputStream- Throws:
IOException
-
nextChunk
protected int nextChunk() throws IOExceptionReads 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()
-
-