1 7 8 package com.sun.imageio.plugins.jpeg; 9 10 import javax.imageio.metadata.IIOInvalidTreeException ; 11 import javax.imageio.metadata.IIOMetadataNode ; 12 import javax.imageio.stream.ImageOutputStream ; 13 14 import java.io.IOException ; 15 16 import org.w3c.dom.Node ; 17 18 21 class DRIMarkerSegment extends MarkerSegment { 22 25 int restartInterval = 0; 26 27 DRIMarkerSegment(JPEGBuffer buffer) 28 throws IOException { 29 super(buffer); 30 restartInterval = (buffer.buf[buffer.bufPtr++] & 0xff) << 8; 31 restartInterval |= buffer.buf[buffer.bufPtr++] & 0xff; 32 buffer.bufAvail -= length; 33 } 34 35 DRIMarkerSegment(Node node) throws IIOInvalidTreeException { 36 super(JPEG.DRI); 37 updateFromNativeNode(node, true); 38 } 39 40 IIOMetadataNode getNativeNode() { 41 IIOMetadataNode node = new IIOMetadataNode ("dri"); 42 node.setAttribute("interval", Integer.toString(restartInterval)); 43 return node; 44 } 45 46 void updateFromNativeNode(Node node, boolean fromScratch) 47 throws IIOInvalidTreeException { 48 restartInterval = getAttributeValue(node, null, "interval", 49 0, 65535, true); 50 } 51 52 56 void write(ImageOutputStream ios) throws IOException { 57 } 59 60 void print() { 61 printTag("DRI"); 62 System.out.println("Interval: " 63 + Integer.toString(restartInterval)); 64 } 65 } 66 67 | Popular Tags |