|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
ccs.crypt.CipherInputStream
public abstract class CipherInputStream
The base class for input streams returned by Cipher subclasses. A CipherInputStream reads an underlying stream of Ciphertext and provides plaintext.
Field Summary | |
---|---|
protected boolean |
isDelimit
Whether this stream is self-delimiting. |
protected byte[] |
temp8
An 8-byte scratch space. |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
protected |
CipherInputStream(java.io.InputStream is,
boolean isDelimit)
Creates a new CipherInputStream based on the supplied underlying stream. |
Method Summary | |
---|---|
int |
available()
Returns the number of bytes that can be read from the underlying input stream without blocking. |
void |
close()
Finishes with this decryption, releases the decryption engine and closes the underlying stream. |
abstract void |
finish()
Finishes with this decryption and releases the decryption engine, but does not close the underlying stream. |
void |
mark(int readlimit)
Does nothing: mark / reset is not supported. |
boolean |
markSupported()
Indicates whether this input stream supports the mark
and reset methods, which it does not. |
int |
read()
Returns the next byte of plaintext as an int in the range 0 - 255, or -1 if the stream is exhausted. |
int |
read(byte[] b)
Reads up to b.length bytes into b . |
abstract int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of plaintext into b[], starting at off. |
void |
reset()
Does nothing: mark / reset is not supported. |
long |
skip(long n)
Skips over and discards n bytes of data from this
input stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte[] temp8
Unsigned.writePacked(java.io.OutputStream, long, byte[])
protected boolean isDelimit
Constructor Detail |
---|
protected CipherInputStream(java.io.InputStream is, boolean isDelimit)
getInputStream()
method of a Cipher
to obatain a CipherInputStream
. NB. This ctor does not set
the dam. Recommended strategy: on first read (set a flag to detect this)
set the dam to the correct ciphertext length (if delimited), then write away.
is
- The underlying (ciphertext) streamMethod Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- if an error occurs.public abstract int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- The buffer to read into. Cannot be null
.off
- The starting offset.len
- The maximum number of bytes to read.
java.io.IOException
- if an I/O error occurs.public int read(byte[] b) throws java.io.IOException
b.length
bytes into b
. Exactly
equivalent to read(b, 0, b.length)
.
read
in class java.io.FilterInputStream
b
- The buffer to read into. Cannot be null
.
java.io.IOException
- if an I/O error occurs.public long skip(long n) throws java.io.IOException
n
bytes of data from this
input stream. Unlike its superclass, this method is guaranteed
to skip the number of bytes requested unless the stream comes up short.
skip
in class java.io.FilterInputStream
n
- The number of bytes to be skipped.
java.io.IOException
- if an I/O error occurs.public int available() throws java.io.IOException
available
in class java.io.FilterInputStream
java.io.IOException
- If an I/O error occurs.public abstract void finish() throws java.io.IOException
java.io.IOException
- if an error occurs.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.FilterInputStream
java.io.IOException
- if an error occurs.public void mark(int readlimit)
mark
in class java.io.FilterInputStream
readlimit
- Ignored.public void reset()
reset
in class java.io.FilterInputStream
public boolean markSupported()
mark
and reset
methods, which it does not.
markSupported
in class java.io.FilterInputStream
false
- mark/reset isn't supported.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |