iaik.utils
Class PemOutputStream
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--iaik.utils.Base64OutputStream
|
+--iaik.utils.PemOutputStream
- public class PemOutputStream
- extends Base64OutputStream
This stream can be used to convert a binary DER output stream to a
PEM style base64 encoded output stream.
The result written to the underlying stream will look something like:
-----BEGIN RSA PRIVATE KEY-----
Base64 encoded data
-----END RSA PRIVATE KEY-----
All lines will be terminated by '\n'.
| Fields inherited from class java.io.FilterOutputStream |
out |
|
Constructor Summary |
PemOutputStream(java.io.OutputStream out,
java.lang.String firstLine,
java.lang.String lastLine)
Creates a new PemOutputStream. |
|
Method Summary |
void |
flush()
Flushes the stream and writes the last line. |
| Methods inherited from class java.io.FilterOutputStream |
close,
write |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
PemOutputStream
public PemOutputStream(java.io.OutputStream out,
java.lang.String firstLine,
java.lang.String lastLine)
throws java.io.IOException
- Creates a new PemOutputStream.
- Parameters:
out - a stream of DER encoded datafirstLine - the first line in the stream to writelastLine - the last line in the stream to write- Throws:
- java.io.IOException - if occurs an I/O error while writing the first line
flush
public void flush()
throws java.io.IOException
- Flushes the stream and writes the last line.
This methos also ensures that flush() is only called for one time
to avoid writing the last line for several times.
- Overrides:
- flush in class Base64OutputStream
- Throws:
- java.io.IOException - if there occurs an I/O error