Class DCTDecode


  • public class DCTDecode
    extends java.lang.Object
    decode a DCT encoded array into a byte array. This class uses Java's built-in JPEG image class to do the decoding.
    • Constructor Summary

      Constructors 
      Constructor Description
      DCTDecode()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.nio.ByteBuffer decode​(PDFObject dict, java.nio.ByteBuffer buf, PDFObject params)
      decode an array of bytes in DCT format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DCTDecode

        public DCTDecode()
    • Method Detail

      • decode

        protected static java.nio.ByteBuffer decode​(PDFObject dict,
                                                    java.nio.ByteBuffer buf,
                                                    PDFObject params)
                                             throws PDFParseException
        decode an array of bytes in DCT format.

        DCT is the format used by JPEG images, so this class simply loads the DCT-format bytes as an image, then reads the bytes out of the image to create the array. Unfortunately, their most likely use is to get turned BACK into an image, so this isn't terribly efficient... but is is general... don't hit, please.

        The DCT-encoded stream may have 1, 3 or 4 samples per pixel, depending on the colorspace of the image. In decoding, we look for the colorspace in the stream object's dictionary to decide how to decode this image. If no colorspace is present, we guess 3 samples per pixel.

        Parameters:
        dict - the stream dictionary
        buf - the DCT-encoded buffer
        params - the parameters to the decoder (ignored)
        Returns:
        the decoded buffer
        Throws:
        PDFParseException