public Object clone() { J2KMetadata theClone = null; try { theClone = (J2KMetadata) super.clone(); } catch (CloneNotSupportedException e) {} // won't happen if (boxes != null) { int numBoxes = boxes.size(); for(int i = 0; i < numBoxes; i++) { theClone.addNode((Box)boxes.get(i)); } } return theClone; }
/** * This method reads the contents of the Intellectual property box * */ public void readIntPropertyBox(int length) throws IOException { if (metadata != null) { byte[] data = new byte[length]; in.readFully(data, 0, length); metadata.addNode(new Box(length + 8, 0x6A703269, data)); } }
/** * This method reads the contents of the XML box */ public void readXMLBox(int length) throws IOException { if (metadata != null) { byte[] data = new byte[length]; in.readFully(data, 0, length); metadata.addNode(new XMLBox(data)); } }
/** Read the bits per component. */ public void readBitsPerComponentBox(int length)throws IOException { bitDepths = new byte[length]; in.readFully(bitDepths, 0, length); if (metadata != null) { metadata.addNode(new BitsPerComponentBox(bitDepths)); } }
/** * This method reads the contents of the XML box */ public void readURLBox(int length) throws IOException { if (metadata != null) { byte[] data = new byte[length]; in.readFully(data, 0, length); metadata.addNode(new DataEntryURLBox(data)); } }
/** * This method reads the contents of the Intellectual property box */ public void readUUIDBox(int length) throws IOException { if (metadata != null) { byte[] data = new byte[length]; in.readFully(data, 0, length); metadata.addNode(new UUIDBox(data)); } }
/** * This method reads the contents of the UUID List box * */ public void readUUIDListBox(int length) throws IOException { if (metadata != null) { byte[] data = new byte[length]; in.readFully(data, 0, length); metadata.addNode(new UUIDListBox(data)); } }
/** Read the resolution. */ public void readResolutionBox(int type, int length)throws IOException { byte[] data = new byte[length]; in.readFully(data, 0, length); if (metadata != null) { metadata.addNode(new ResolutionBox(type, data)); } }
/** Read the component mapping channel. */ public void readComponentMappingBox(int length)throws IOException { int num = length / 4; comps = new short[num]; type = new byte[num]; maps = new byte[num]; for (int i = 0; i < num; i++) { comps[i] = in.readShort(); type[i] = in.readByte(); maps[i] = in.readByte(); } if (metadata != null) { metadata.addNode(new ComponentMappingBox(comps, type, maps)); } }
metadata.addNode(new FileTypeBox(FT_BR, minorVersion, comp));
/** * This method reads the Channel Definition box * * @exception java.io.IOException If an I/O error ocurred. * */ public void readChannelDefinitionBox(int length)throws IOException { int num = in.readShort(); channels = new short[num]; cType = new short[num]; associations = new short[num]; for (int i = 0; i < num; i++) { channels[i] = in.readShort(); cType[i] = in.readShort(); associations[i] = in.readShort(); } if (metadata != null) { metadata.addNode(new ChannelDefinitionBox(channels, cType, associations)); } }
ImageWriter writer) { this(); addNode(new SignatureBox()); addNode(new FileTypeBox(0x6A703220, 0, new int[]{0x6A703220})); addNode(new ColorSpecificationBox((byte)1, (byte)0, (byte)0, ColorSpecificationBox.ECS_sRGB, null)); } else if (type == ColorSpace.TYPE_GRAY) addNode(new ColorSpecificationBox((byte)1, (byte)0, (byte)0, ColorSpecificationBox.ECS_GRAY, null)); else if (cs instanceof ICC_ColorSpace) addNode(new ColorSpecificationBox((byte)2, (byte)0, (byte)0, 0, addNode(new ChannelDefinitionBox(colorModel)); addNode(new PaletteBox((IndexColorModel)colorModel)); int numComp = colorModel.getComponentSize().length; short[] channels = new short[numComp]; addNode(new ComponentMappingBox(channels, types, maps)); 0xff : ((bitsPerComponent - 1) | (isOriginalSigned(sampleModel) ? 0x80 : 0));
/** * This method reads the Image Header box * @param length The length of the JP2Header box * * @return false if the JP2Header box was not found or invalid else true * * @exception java.io.IOException If an I/O error ocurred. * * @exception java.io.EOFException If the end of file was reached * */ public boolean readImageHeaderBox(int length) throws IOException, EOFException { if(length == 0) // This can not be last box throw new Error("Zero-length of JP2Header Box"); // Here the JP2Header data (DBox) would be read if we were to use it height = in.readInt(); width = in.readInt(); numComp = in.readShort(); bitDepth = in.readByte(); compressionType = in.readByte(); unknownColor = in.readByte(); intelProp = in.readByte(); if (metadata != null) { metadata.addNode(new HeaderBox(height, width, numComp, bitDepth, compressionType, unknownColor, intelProp)); } return true; }
/** Read the color specifications. */ public void readColourSpecificationBox(int length)throws IOException { // read METHOD field byte method = (byte)in.readByte(); // read PREC field byte prec = (byte)in.readByte(); // read APPROX field byte approx = (byte)in.readByte(); if (method == 2) { byte[] data = new byte[length - 3]; in.readFully(data, 0, data.length); profile = ICC_Profile.getInstance(data); } else // read EnumCS field colorSpaceType = in.readInt(); if (metadata != null) { metadata.addNode(new ColorSpecificationBox(method, prec, approx, colorSpaceType, profile)); } }
metadata.addNode(new PaletteBox(length, compSize, lut));