|
|||||||||
| Home >> All >> javax >> [ crypto overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.crypto
Class CipherInputStream

java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
javax.crypto.CipherInputStream
- All Implemented Interfaces:
- java.io.Closeable
- public class CipherInputStream
- extends java.io.FilterInputStream
This is an java.io.InputStream that filters its data
through a Cipher before returning it. The Cipher
argument must have been initialized before it is passed to the
constructor.
| Field Summary | |
private Cipher |
cipher
The underlying Cipher instance. |
private boolean |
eof
Whether or not we've reached the end of the stream. |
private boolean |
isStream
We set this when the cipher block size is 1, meaning that we can transform any amount of data. |
private static java.util.logging.Logger |
logger
|
private byte[] |
outBuffer
Data that has been transformed but not read. |
private int |
outOffset
The offset into outBuffer 55 where valid data starts. |
| Fields inherited from class java.io.FilterInputStream |
in |
| Constructor Summary | |
protected |
CipherInputStream(java.io.InputStream in)
Creates a new input stream without a cipher. |
|
CipherInputStream(java.io.InputStream in,
Cipher cipher)
Creates a new input stream with a source input stream and cipher. |
| Method Summary | |
int |
available()
Returns the number of bytes available without blocking. |
void |
close()
Close this input stream. |
void |
mark(int mark)
Set the mark. |
boolean |
markSupported()
Returns whether or not this input stream supports the #mark(long) and reset() 55 methods; this input stream does
not, however, and invariably returns false. |
private void |
nextBlock()
|
int |
read()
Read a single byte from this input stream; returns -1 on the end-of-file. |
int |
read(byte[] buf)
Read bytes into an array, returning the number of bytes read or -1 on the end-of-file. |
int |
read(byte[] buf,
int off,
int len)
Read bytes into an array, returning the number of bytes read or -1 on the end-of-file. |
void |
reset()
Reset to the mark. |
long |
skip(long bytes)
Skip a number of bytes. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
logger
private static final java.util.logging.Logger logger
cipher
private final Cipher cipher
- The underlying Cipher instance.
outBuffer
private byte[] outBuffer
- Data that has been transformed but not read.
outOffset
private int outOffset
- The offset into
outBuffer55 where valid data starts.
isStream
private final boolean isStream
- We set this when the cipher block size is 1, meaning that we can
transform any amount of data.
eof
private boolean eof
- Whether or not we've reached the end of the stream.
| Constructor Detail |
CipherInputStream
public CipherInputStream(java.io.InputStream in, Cipher cipher)
- Creates a new input stream with a source input stream and cipher.
CipherInputStream
protected CipherInputStream(java.io.InputStream in)
- Creates a new input stream without a cipher. This constructor is
protectedbecause this class does not work without an underlying cipher.
| Method Detail |
available
public int available()
throws java.io.IOException
- Returns the number of bytes available without blocking. The value
returned is the number of bytes that have been processed by the
cipher, and which are currently buffered by this class.
close
public void close()
throws java.io.IOException
- Close this input stream. This method merely calls the InputStream.close()>
InputStream.close()55 method of the underlying input stream.
read
public int read()
throws java.io.IOException
- Read a single byte from this input stream; returns -1 on the
end-of-file.
read
public int read(byte[] buf,
int off,
int len)
throws java.io.IOException
- Read bytes into an array, returning the number of bytes read or -1
on the end-of-file.
read
public int read(byte[] buf)
throws java.io.IOException
- Read bytes into an array, returning the number of bytes read or -1
on the end-of-file.
skip
public long skip(long bytes)
throws java.io.IOException
- Skip a number of bytes. This class only supports skipping as many
bytes as are returned by
available()55 , which is the number of transformed bytes currently in this class's internal buffer.
markSupported
public boolean markSupported()
- Returns whether or not this input stream supports the
#mark(long)andreset()55 methods; this input stream does not, however, and invariably returnsfalse.
mark
public void mark(int mark)
- Set the mark. This method is unsupported and is empty.
reset
public void reset()
throws java.io.IOException
- Reset to the mark. This method is unsupported and is empty.
nextBlock
private void nextBlock()
throws java.io.IOException
|
|||||||||
| Home >> All >> javax >> [ crypto overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC