java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
no.uio.ifi.crypt4gh.stream.Crypt4GHOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Crypt4GHOutputStream that wraps existing OutputStream.
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorDescriptionCrypt4GHOutputStream
(OutputStream out, PrivateKey writerPrivateKey, PublicKey readerPublicKey) Constructs the Crypt4GHOutputStream by wrapping existing OutputStream.Crypt4GHOutputStream
(OutputStream out, no.uio.ifi.crypt4gh.pojo.header.DataEditList dataEditList, PrivateKey writerPrivateKey, PublicKey readerPublicKey) Constructs the Crypt4GHOutputStream by wrapping existing OutputStream with DataEditList included to a header. -
Method Summary
Methods inherited from class java.io.FilterOutputStream
close, write, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
Crypt4GHOutputStream
public Crypt4GHOutputStream(OutputStream out, PrivateKey writerPrivateKey, PublicKey readerPublicKey) throws IOException, GeneralSecurityException Constructs the Crypt4GHOutputStream by wrapping existing OutputStream.- Parameters:
out
- Existing OutputStream.writerPrivateKey
- Sender's private key.readerPublicKey
- Recipient's public key.- Throws:
IOException
- In case the Crypt4GH header can't be read from the underlying OutputStream.GeneralSecurityException
- In case the Crypt4GH header is malformed.
-
Crypt4GHOutputStream
public Crypt4GHOutputStream(OutputStream out, no.uio.ifi.crypt4gh.pojo.header.DataEditList dataEditList, PrivateKey writerPrivateKey, PublicKey readerPublicKey) throws IOException, GeneralSecurityException Constructs the Crypt4GHOutputStream by wrapping existing OutputStream with DataEditList included to a header.- Parameters:
out
- Existing OutputStream.dataEditList
- Data Edit List.writerPrivateKey
- Sender's private key.readerPublicKey
- Recipient's public key.- Throws:
IOException
- In case the Crypt4GH header can't be read from the underlying OutputStream.GeneralSecurityException
- In case the Crypt4GH header is malformed.
-
-
Method Details
-
getHeader
public no.uio.ifi.crypt4gh.pojo.header.Header getHeader()Gets header.- Returns:
- Crypt4GH full header.
-
write
Writes a byte to an internal buffer and flushes this buffer when it get's full.- Overrides:
write
in classFilterOutputStream
- Parameters:
b
- A byte to write.- Throws:
IOException
- In case the byte can't be written or the buffer can't be flushed.
-
flushBuffer
- Throws:
IOException
GeneralSecurityException
-
flush
Flushes the internal buffer before flushing the underlying stream.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classFilterOutputStream
- Throws:
IOException
- In case if the buffer or underlying stream can't be flushed.
-