|
Cryptix OpenPGP | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
cryptix.message.stream.MessageOutputStream
A generic stream that encapsulates another stream in some message format.
Field Summary | |
protected MessageOutputStreamSpi |
spi
|
Constructor Summary | |
protected |
MessageOutputStream(MessageOutputStreamSpi spi,
java.security.Provider provider,
java.lang.String format)
Create a new MessageOutputStream object containing the given SPI object. |
Method Summary | |
void |
close()
Close the stream Sends all data through the underlying stream and then calls the close() method of the underlying stream. |
void |
flush()
Flush the stream What flushing does is format specific. |
java.lang.String |
getFormat()
Returns the name of the format of this object. |
java.security.Provider |
getProvider()
Returns the provider of this object. |
MessageOutputStreamSpi |
getSpi()
Return the underlying service provider interface This method should not be called by user applications. |
void |
init(java.io.OutputStream out,
java.security.SecureRandom sr)
Initializes this outputstream with the given outputstream as underlying stream and the given SecureRandom object. |
void |
setAttribute(java.lang.String name,
java.lang.Object attr)
Set a format specific attribute. |
void |
write(byte[] b)
Write a complete bytearray to the stream |
void |
write(byte[] b,
int off,
int len)
Write the specified part of a bytearray to the stream. |
void |
write(int b)
Write a single byte to the stream |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final MessageOutputStreamSpi spi
Constructor Detail |
protected MessageOutputStream(MessageOutputStreamSpi spi, java.security.Provider provider, java.lang.String format)
Method Detail |
public final java.security.Provider getProvider()
public final java.lang.String getFormat()
public final void init(java.io.OutputStream out, java.security.SecureRandom sr) throws java.lang.IllegalStateException, java.io.IOException, MessageStreamException
out
- The underlying outputstream this stream will write results to.sr
- A SecureRandom object used for any randomness needed.
java.lang.IllegalStateException
- if this message has been initialized
before.
java.io.IOException
- on a general IOException that is not format specific.
MessageStreamException
- on a variety of format specific problems.public final void setAttribute(java.lang.String name, java.lang.Object attr) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException, MessageStreamException
name
- a name identifying the attributeattr
- the attribute itself
java.lang.IllegalStateException
- if this message has not been initialized
before.
java.lang.IllegalArgumentException
- if the attribute is not supported or the
given object does not have the right type.
MessageStreamException
- on a variety of format specific problems.public final void write(byte[] b, int off, int len) throws java.io.IOException, MessageStreamException
b
- the dataoff
- the starting point of the write operationlen
- how many bytes to write
java.io.IOException
- on a general IOException that is not format specific.
MessageStreamException
- on a variety of format specific problems.public final void write(byte[] b) throws java.io.IOException, MessageStreamException
b
- the data
java.io.IOException
- on a general IOException that is not format specific.
MessageStreamException
- on a variety of format specific problems.public final void write(int b) throws java.io.IOException, MessageStreamException
b
- the byte to write
java.io.IOException
- on a general IOException that is not format specific.
MessageStreamException
- on a variety of format specific problems.public final void flush() throws java.io.IOException, MessageStreamException
What flushing does is format specific. The general contract is that as much bytes as possible are written to the underlying datastream, but no guarantees are given about any buffers left. The reason for this is because cryptographic protocols usually work on specific blocksizes and there usually are only handlers (padding) for incomplete blocks at the end of the stream.
This method should call the flush() method of the underlying outputstream after it is done.
java.io.IOException
- on a general IOException that is not format specific.
MessageStreamException
- on a variety of format specific problems.public final void close() throws java.io.IOException, MessageStreamException
Sends all data through the underlying stream and then calls the close() method of the underlying stream.
java.io.IOException
- on a general IOException that is not format specific.
MessageStreamException
- on a variety of format specific problems.public final MessageOutputStreamSpi getSpi()
This method should not be called by user applications.
|
Cryptix OpenPGP | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |