edu.harvard.hul.ois.jhove.module.jpeg2000
Class BoxHeader

java.lang.Object
  extended by edu.harvard.hul.ois.jhove.module.jpeg2000.BoxHeader

public class BoxHeader
extends java.lang.Object

Encapsulation of a JPEG 2000 box header.

Author:
Gary McGath

Constructor Summary
BoxHeader(Jpeg2000Module mod, java.io.DataInputStream dstrm)
          Constructor.
 
Method Summary
 long getDataLength()
          Returns the number of bytes in the Box, not including the header.
 long getHeaderLength()
          Returns the length of the header.
 long getLength()
          Returns the box length, which includes the length and type fields.
 java.lang.String getType()
          Returns the box type.
 void readHeader()
          Reads 8 bytes from the beginning of the box and parses out the box length and type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoxHeader

public BoxHeader(Jpeg2000Module mod,
                 java.io.DataInputStream dstrm)
Constructor.

Parameters:
mod - The Module which uses this object
dstrm - The DataInputStream reading data for the Module
Method Detail

readHeader

public void readHeader()
                throws java.io.IOException
Reads 8 bytes from the beginning of the box and parses out the box length and type.

Throws:
java.io.IOException

getLength

public long getLength()
Returns the box length, which includes the length and type fields. If the value returned is 0, the length of the box is all the remaining data to the end of the file.


getHeaderLength

public long getHeaderLength()
Returns the length of the header. This number is equal to the number of bytes that have been read by readHeader().


getDataLength

public long getDataLength()
Returns the number of bytes in the Box, not including the header. This is equivalent to getLength() - getHeaderLength(). If getLength() would return 0, this value is meaningless.


getType

public java.lang.String getType()
Returns the box type.