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.SdkFilterInputStream
A cipher stream for encrypting or decrypting data using an unauthenticated block cipher.
-
-
Field Summary
Fields Modifier and Type Field Description protected Cipher
cipher
protected int
currentPosition
protected boolean
eofReached
protected byte[]
inputBuffer
protected int
maxPosition
protected 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 int
available()
void
close()
protected int
endOfFileReached()
void
mark(int readlimit)
boolean
markSupported()
protected int
nextChunk()
Reads and process the next chunk of data into memory.int
read()
int
read(byte[] buffer)
int
read(byte[] buffer, int off, int targetLength)
void
reset()
long
skip(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:
read
in classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer, int off, int targetLength) throws IOException
- Overrides:
read
in 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:
skip
in classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
available
public int available()
- Overrides:
available
in classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classsoftware.amazon.awssdk.core.io.SdkFilterInputStream
-
reset
public void reset() throws IOException
- Overrides:
reset
in classsoftware.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()
-
-