use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.
the class FileFormatReader method readImageHeaderBox.
/**
* 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 (// This can not be last box
length == 0)
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;
}
use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.
the class FileFormatReader method readURLBox.
/**
* 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));
}
}
use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.
the class FileFormatReader method readUUIDListBox.
/**
* 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));
}
}
use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.
the class FileFormatReader method readIntPropertyBox.
/**
* 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));
}
}
use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.
the class FileFormatWriter method writeBox.
private void writeBox(IIOMetadataNode node) throws IOException {
int type = Box.getTypeInt((String) Box.getAttribute(node, "Type"));
int length = new Integer((String) Box.getAttribute(node, "Length")).intValue();
Box box = Box.createBox(type, node);
otherLength += length;
stream.writeInt(length);
stream.writeInt(type);
byte[] data = box.getContent();
stream.write(data, 0, data.length);
}
Aggregations