Package com.google.zxing.client.j2se
Class DecodeWorker
- java.lang.Object
-
- com.google.zxing.client.j2se.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
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BLACK
private DecoderConfig
config
private java.util.Map<DecodeHintType,?>
hints
private java.util.Queue<java.net.URI>
inputs
private static int
RED
private static int
WHITE
-
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)
-
-
-
Field Detail
-
RED
private static final int RED
- See Also:
- Constant Field Values
-
BLACK
private static final int BLACK
- See Also:
- Constant Field Values
-
WHITE
private static final int WHITE
- See Also:
- Constant Field Values
-
config
private final DecoderConfig config
-
inputs
private final java.util.Queue<java.net.URI> inputs
-
hints
private final java.util.Map<DecodeHintType,?> hints
-
-
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 interfacejava.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
-
-