src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java

Print this page
rev 9230 : imported patch 8033716

*** 41,51 **** /** * A DHT (Define Huffman Table) marker segment. */ class DHTMarkerSegment extends MarkerSegment { ! List tables = new ArrayList(); DHTMarkerSegment(boolean needFour) { super(JPEG.DHT); tables.add(new Htable(JPEGHuffmanTable.StdDCLuminance, true, 0)); if (needFour) { --- 41,51 ---- /** * A DHT (Define Huffman Table) marker segment. */ class DHTMarkerSegment extends MarkerSegment { ! List<Htable> tables = new ArrayList<>(); DHTMarkerSegment(boolean needFour) { super(JPEG.DHT); tables.add(new Htable(JPEGHuffmanTable.StdDCLuminance, true, 0)); if (needFour) {
*** 89,113 **** for (int i = 0; i < size; i++) { tables.add(new Htable(children.item(i))); } } ! protected Object clone() { 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; } IIOMetadataNode getNativeNode() { 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; } --- 89,113 ---- for (int i = 0; i < size; i++) { tables.add(new Htable(children.item(i))); } } ! protected DHTMarkerSegment clone() { DHTMarkerSegment newGuy = (DHTMarkerSegment) super.clone(); ! newGuy.tables = new ArrayList<>(tables.size()); ! Iterator<Htable> iter = tables.iterator(); while (iter.hasNext()) { ! Htable table = iter.next(); newGuy.tables.add(table.clone()); } return newGuy; } IIOMetadataNode getNativeNode() { IIOMetadataNode node = new IIOMetadataNode("dht"); for (int i= 0; i<tables.size(); i++) { ! Htable table = tables.get(i); node.appendChild(table.getNativeNode()); } return node; }
*** 122,132 **** void print() { 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(); } --- 122,132 ---- void print() { printTag("DHT"); System.out.println("Num tables: " + Integer.toString(tables.size())); for (int i= 0; i<tables.size(); i++) { ! Htable table = tables.get(i); table.print(); } System.out.println(); }
*** 203,213 **** ("Invalid node, expected dqtable", node); } } ! protected Object clone() { Htable newGuy = null; try { newGuy = (Htable) super.clone(); } catch (CloneNotSupportedException e) {} // won't happen if (numCodes != null) { --- 203,213 ---- ("Invalid node, expected dqtable", node); } } ! protected Htable clone() { Htable newGuy = null; try { newGuy = (Htable) super.clone(); } catch (CloneNotSupportedException e) {} // won't happen if (numCodes != null) {