FileDocCategorySizeDatePackage
DHTMarkerSegment.javaAPI DocJava SE 5 API8190Fri Aug 26 14:54:42 BST 2005com.sun.imageio.plugins.jpeg

DHTMarkerSegment

public class DHTMarkerSegment extends MarkerSegment
A DHT (Define Huffman Table) marker segment.

Fields Summary
List
tables
Constructors Summary
DHTMarkerSegment(boolean needFour)


      
        super(JPEG.DHT);
        tables.add(new Htable(JPEGHuffmanTable.StdDCLuminance, true, 0));
        if (needFour) {
            tables.add(new Htable(JPEGHuffmanTable.StdDCChrominance, true, 1));
        }
        tables.add(new Htable(JPEGHuffmanTable.StdACLuminance, false, 0));
        if (needFour) {
            tables.add(new Htable(JPEGHuffmanTable.StdACChrominance, false, 1));
        }
    
DHTMarkerSegment(JPEGBuffer buffer)

        super(buffer);
        int count = length;
        while (count > 0) {
            Htable newGuy = new Htable(buffer);
            tables.add(newGuy);
            count -= 1 + 16 + newGuy.values.length;
        }
        buffer.bufAvail -= length;
    
DHTMarkerSegment(JPEGHuffmanTable[] dcTables, JPEGHuffmanTable[] acTables)

        super(JPEG.DHT);
        for (int i = 0; i < dcTables.length; i++) {
            tables.add(new Htable(dcTables[i], true, i));
        }
        for (int i = 0; i < acTables.length; i++) {
            tables.add(new Htable(acTables[i], false, i));
        }
    
DHTMarkerSegment(Node node)

        super(JPEG.DHT);
        NodeList children = node.getChildNodes();
        int size = children.getLength();
        if ((size < 1) || (size > 4)) {
            throw new IIOInvalidTreeException("Invalid DHT node", node);
        }
        for (int i = 0; i < size; i++) {
            tables.add(new Htable(children.item(i)));
        }
    
Methods Summary
voidaddHtable(javax.imageio.plugins.jpeg.JPEGHuffmanTable table, boolean isDC, int id)

        tables.add(new Htable(table, isDC, id));
    
protected java.lang.Objectclone()

        DHTMarkerSegment newGuy = (DHTMarkerSegment) super.clone();
        newGuy.tables = new ArrayList(tables.size());
        Iterator iter = tables.iterator();
        while (iter.hasNext()) {
            Htable table = (Htable) iter.next();
            newGuy.tables.add(table.clone());
        }
        return newGuy;
    
com.sun.imageio.plugins.jpeg.DHTMarkerSegment$HtablegetHtableFromNode(org.w3c.dom.Node node)

        return new Htable(node);
    
javax.imageio.metadata.IIOMetadataNodegetNativeNode()

        IIOMetadataNode node = new IIOMetadataNode("dht");
        for (int i= 0; i<tables.size(); i++) {
            Htable table = (Htable) tables.get(i);
            node.appendChild(table.getNativeNode());
        }
        return node;           
    
voidprint()

        printTag("DHT");
        System.out.println("Num tables: " 
                           + Integer.toString(tables.size()));
        for (int i= 0; i<tables.size(); i++) {
            Htable table = (Htable) tables.get(i);
            table.print();
        }
        System.out.println();
            
    
voidwrite(javax.imageio.stream.ImageOutputStream ios)
Writes the data for this segment to the stream in valid JPEG format.

        // We don't write DHT segments; the IJG library does.