public class Parse
extends java.lang.Object
A class to parse a JPEG bitstream.
Includes the ability to selectively redact blocks and leave other blocks alone, to permit "lossless" redaction.
Includes the ability to decompress lossless JPEG.
Development of this class was supported by funding from MDDX Research and Informatics.
Modifier and Type | Class and Description |
---|---|
static class |
Parse.DecompressedOutput |
static class |
Parse.MarkerSegmentsFoundDuringParse |
Constructor and Description |
---|
Parse() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] arg)
Test utility to read and write a JPEG file to check parsing is sound.
|
static Parse.MarkerSegmentsFoundDuringParse |
parse(java.io.InputStream in,
java.io.OutputStream copiedRedactedOutputStream,
java.util.Vector<java.awt.Shape> redactionShapes)
Parse a JPEG bitstream and copying to the output redacting any blocks that intersect with the specified locations.
|
static Parse.MarkerSegmentsFoundDuringParse |
parse(java.io.InputStream in,
java.io.OutputStream copiedRedactedOutputStream,
java.util.Vector<java.awt.Shape> redactionShapes,
Parse.DecompressedOutput decompressedOutput)
Parse a JPEG bitstream and either copy to the output redacting any blocks that intersect with the specified locations, or decompress.
|
public static Parse.MarkerSegmentsFoundDuringParse parse(java.io.InputStream in, java.io.OutputStream copiedRedactedOutputStream, java.util.Vector<java.awt.Shape> redactionShapes, Parse.DecompressedOutput decompressedOutput) throws java.lang.Exception, java.io.IOException
Parse a JPEG bitstream and either copy to the output redacting any blocks that intersect with the specified locations, or decompress.
Parsing and redaction is implemented only for baseline (8 bit DCT Huffman).
Parsing and decompression is implemented only for lossless sequential Huffman.
in
- the input JPEG bitstreamcopiedRedactedOutputStream
- the output JPEG bitstream, redacted as specifiedredactionShapes
- a Vector of Shape that are RectangledecompressedOutput
- the decompressed output (with specified or default endianness if precision > 8)java.lang.Exception
- if bad things happen parsing the JPEG bit stream, caused by malformed inputjava.io.IOException
- if bad things happen reading or writingpublic static Parse.MarkerSegmentsFoundDuringParse parse(java.io.InputStream in, java.io.OutputStream copiedRedactedOutputStream, java.util.Vector<java.awt.Shape> redactionShapes) throws java.lang.Exception, java.io.IOException
Parse a JPEG bitstream and copying to the output redacting any blocks that intersect with the specified locations.
Parsing and redaction is implemented only for baseline (8 bit DCT Huffman).
in
- the input JPEG bitstreamcopiedRedactedOutputStream
- the output JPEG bitstream, redacted as specifiedredactionShapes
- a Vector of Shape that are Rectanglejava.lang.Exception
- if bad things happen parsing the JPEG bit stream, caused by malformed inputjava.io.IOException
- if bad things happen reading or writingpublic static void main(java.lang.String[] arg)
Test utility to read and write a JPEG file to check parsing is sound.
If only an input file is supplied, will dump rather than copy.
If a decompressed output file is supplied, will write in big endian if precision greater than 8, and will appended component number before file extension iff more than one component.
arg
- two or three parameters, the input file, the copied compressed output file, and the decompressed output file