|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
javax.crypto.CipherOutputStream
public class CipherOutputStream
A filtered output stream that transforms data written to it with a
Cipher before sending it to the underlying output stream.
| Field Summary |
|---|
| Fields inherited from class java.io.FilterOutputStream |
|---|
out |
| Constructor Summary | |
|---|---|
protected |
CipherOutputStream(OutputStream out)
Create a cipher output stream with no cipher. |
|
CipherOutputStream(OutputStream out,
Cipher cipher)
Create a new cipher output stream. |
| Method Summary | |
|---|---|
void |
close()
Close this output stream, and the sink output stream. |
void |
flush()
Flush any pending output. |
void |
write(byte[] buf)
Write a byte array to the output stream. |
void |
write(byte[] buf,
int off,
int len)
Write a portion of a byte array to the output stream. |
void |
write(int b)
Write a single byte to the output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CipherOutputStream(OutputStream out,
Cipher cipher)
out - The sink for transformed data.cipher - The cipher to transform data with.protected CipherOutputStream(OutputStream out)
out - The sink for transformed data.| Method Detail |
|---|
public void close()
throws IOException
This method will first invoke the Cipher.doFinal() method of the
underlying Cipher, and writes the output of that method to the
sink output stream.
close in interface Closeableclose in class FilterOutputStreamIOException - If an I/O error occurs, or if an error is caused by
finalizing the transformation.
public void flush()
throws IOException
flush in interface Flushableflush in class FilterOutputStreamIOException - If an I/O error occurs.
public void write(int b)
throws IOException
write in class FilterOutputStreamb - The next byte.
IOException - If an I/O error occurs, or if the underlying cipher is
not in the correct state to transform data.
public void write(byte[] buf)
throws IOException
write in class FilterOutputStreambuf - The next bytes.
IOException - If an I/O error occurs, or if the underlying cipher is
not in the correct state to transform data.
public void write(byte[] buf,
int off,
int len)
throws IOException
write in class FilterOutputStreambuf - The next bytes.off - The offset in the byte array to start.len - The number of bytes to write.
IOException - If an I/O error occurs, or if the underlying cipher is
not in the correct state to transform data.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||