Package org.pgpainless.util
Class StreamGeneratorWrapper
- java.lang.Object
-
- org.pgpainless.util.StreamGeneratorWrapper
-
public final class StreamGeneratorWrapper extends java.lang.ObjectLiteral 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 thePGPCanonicalizedDataGeneratorinstead. 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 voidclose()Close all encoding streams opened by this generator wrapper.static StreamGeneratorWrapperforStreamEncoding(StreamEncoding encoding)Create a new instance for the given encoding.java.io.OutputStreamopen(java.io.OutputStream outputStream, java.lang.String filename, java.util.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 java.io.OutputStream open(java.io.OutputStream outputStream, java.lang.String filename, java.util.Date modificationDate, byte[] buffer) throws java.io.IOExceptionOpen a new encoding stream.- Parameters:
outputStream- wrapped output streamfilename- file namemodificationDate- modification datebuffer- buffer- Returns:
- encoding stream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionClose all encoding streams opened by this generator wrapper.- Throws:
java.io.IOException
-
-