Class DecodeWorker

  • All Implemented Interfaces:
    java.util.concurrent.Callable<java.lang.Integer>

    final class DecodeWorker
    extends java.lang.Object
    implements java.util.concurrent.Callable<java.lang.Integer>
    One of a pool of threads which pulls images off the Inputs queue and decodes them in parallel.
    See Also:
    CommandLineRunner
    • Constructor Summary

      Constructors 
      Constructor Description
      DecodeWorker​(DecoderConfig config, java.util.Queue<java.net.URI> inputs)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.nio.file.Path buildOutputPath​(java.net.URI input, java.lang.String suffix)  
      java.lang.Integer call()  
      private Result[] decode​(java.net.URI uri, java.util.Map<DecodeHintType,​?> hints)  
      private static void dumpBlackPoint​(java.net.URI uri, java.awt.image.BufferedImage image, BinaryBitmap bitmap)
      Writes out a single PNG which is three times the width of the input image, containing from left to right: the original image, the row sampling monochrome version, and the 2D sampling monochrome version.
      private static void dumpResult​(java.net.URI input, Result... results)  
      private static void writeResultImage​(int stride, int height, int[] pixels, java.net.URI input, java.lang.String suffix)  
      • Methods inherited from class java.lang.Object

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

      • DecodeWorker

        DecodeWorker​(DecoderConfig config,
                     java.util.Queue<java.net.URI> inputs)
    • Method Detail

      • call

        public java.lang.Integer call()
                               throws java.io.IOException
        Specified by:
        call in interface java.util.concurrent.Callable<java.lang.Integer>
        Throws:
        java.io.IOException
      • buildOutputPath

        private static java.nio.file.Path buildOutputPath​(java.net.URI input,
                                                          java.lang.String suffix)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • dumpResult

        private static void dumpResult​(java.net.URI input,
                                       Result... results)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • decode

        private Result[] decode​(java.net.URI uri,
                                java.util.Map<DecodeHintType,​?> hints)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • dumpBlackPoint

        private static void dumpBlackPoint​(java.net.URI uri,
                                           java.awt.image.BufferedImage image,
                                           BinaryBitmap bitmap)
                                    throws java.io.IOException
        Writes out a single PNG which is three times the width of the input image, containing from left to right: the original image, the row sampling monochrome version, and the 2D sampling monochrome version.
        Throws:
        java.io.IOException
      • writeResultImage

        private static void writeResultImage​(int stride,
                                             int height,
                                             int[] pixels,
                                             java.net.URI input,
                                             java.lang.String suffix)
                                      throws java.io.IOException
        Throws:
        java.io.IOException