Class StreamGeneratorWrapper


  • public final class StreamGeneratorWrapper
    extends java.lang.Object
    Literal Data can be encoded in different ways. BINARY encoding leaves the data as is and is generated through the PGPLiteralDataGenerator. However, if the data is encoded in TEXT or UTF8 encoding, we need to use the PGPCanonicalizedDataGenerator 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.
      java.io.OutputStream open​(java.io.OutputStream outputStream, java.lang.String filename, java.util.Date modificationDate, byte[] buffer)
      Open a new encoding stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.IOException
        Open a new encoding stream.
        Parameters:
        outputStream - wrapped output stream
        filename - file name
        modificationDate - modification date
        buffer - buffer
        Returns:
        encoding stream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Close all encoding streams opened by this generator wrapper.
        Throws:
        java.io.IOException