Package org.pgpainless.util
Class StreamGeneratorWrapper
- java.lang.Object
-
- org.pgpainless.util.StreamGeneratorWrapper
-
public final class StreamGeneratorWrapper extends Object
Literal Data can be encoded in different ways. BINARY encoding leaves the data as is and is generated through thePGPLiteralDataGenerator
. However, if the data is encoded in TEXT or UTF8 encoding, we need to use thePGPCanonicalizedDataGenerator
instead. This wrapper class acts as a handle for both options and provides a unified interface for them.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close all encoding streams opened by this generator wrapper.static StreamGeneratorWrapper
forStreamEncoding(StreamEncoding encoding)
Create a new instance for the given encoding.OutputStream
open(OutputStream outputStream, String filename, Date modificationDate, byte[] buffer)
Open a new encoding stream.
-
-
-
Method Detail
-
forStreamEncoding
public static StreamGeneratorWrapper forStreamEncoding(@Nonnull StreamEncoding encoding)
Create a new instance for the given encoding.- Parameters:
encoding
- stream encoding- Returns:
- wrapper
-
open
public OutputStream open(OutputStream outputStream, String filename, Date modificationDate, byte[] buffer) throws IOException
Open a new encoding stream.- Parameters:
outputStream
- wrapped output streamfilename
- file namemodificationDate
- modification datebuffer
- buffer- Returns:
- encoding stream
- Throws:
IOException
-
close
public void close() throws IOException
Close all encoding streams opened by this generator wrapper.- Throws:
IOException
-
-