FileDocCategorySizeDatePackage
JPEGImageReadParam.javaAPI DocAndroid 1.5 API3744Wed May 06 22:41:54 BST 2009javax.imageio.plugins.jpeg

JPEGImageReadParam

public class JPEGImageReadParam extends ImageReadParam
The JPEGImageReadParam class provides functionality to set Huffman tables and quantization tables when using the JPEG reader plug-in.
since
Android 1.0

Fields Summary
private JPEGQTable[]
qTables
The q tables.
private JPEGHuffmanTable[]
dcHuffmanTables
The dc huffman tables.
private JPEGHuffmanTable[]
acHuffmanTables
The ac huffman tables.
Constructors Summary
public JPEGImageReadParam()
Instantiates a new JPEGImageReadParam.

    
Methods Summary
public booleanareTablesSet()
Returns true if tables are set, false otherwise.

return
true, if tables are set, false otherwise.

        return qTables != null;
    
public javax.imageio.plugins.jpeg.JPEGHuffmanTable[]getACHuffmanTables()
Gets the AC Huffman tables.

return
the AC Huffman tables which are set, or null.

        return acHuffmanTables == null ? null : acHuffmanTables.clone();
    
public javax.imageio.plugins.jpeg.JPEGHuffmanTable[]getDCHuffmanTables()
Gets the DC Huffman tables.

return
the DC Huffman tables which are set, or null.

        return dcHuffmanTables == null ? null : dcHuffmanTables.clone();
    
public javax.imageio.plugins.jpeg.JPEGQTable[]getQTables()
Gets the quantization tables.

return
the quantization tables, or null.

        return qTables == null ? null : qTables.clone();
    
public voidsetDecodeTables(javax.imageio.plugins.jpeg.JPEGQTable[] qTables, javax.imageio.plugins.jpeg.JPEGHuffmanTable[] DCHuffmanTables, javax.imageio.plugins.jpeg.JPEGHuffmanTable[] ACHuffmanTables)
Sets the quantization and Huffman tables for using in decoding streams.

param
qTables the quantization tables.
param
DCHuffmanTables the standart DC Huffman tables.
param
ACHuffmanTables the standart AC huffman tables.

        if (qTables == null || DCHuffmanTables == null || ACHuffmanTables == null) {
            throw new IllegalArgumentException("Invalid JPEG table arrays");
        }
        if (DCHuffmanTables.length != ACHuffmanTables.length) {
            throw new IllegalArgumentException("Invalid JPEG table arrays");
        }
        if (qTables.length > 4 || DCHuffmanTables.length > 4) {
            throw new IllegalArgumentException("Invalid JPEG table arrays");
        }

        // Do the shallow copy, it should be enough
        this.qTables = qTables.clone();
        dcHuffmanTables = DCHuffmanTables.clone();
        acHuffmanTables = ACHuffmanTables.clone();
    
public voidunsetDecodeTables()
Unset all decoded tables.

        qTables = null;
        dcHuffmanTables = null;
        acHuffmanTables = null;