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

java.lang.Object
  extended by edu.harvard.hul.ois.jhove.module.jpeg2000.BoxHolder
All Implemented Interfaces:
java.util.Iterator<java.lang.Object>
Direct Known Subclasses:
JP2Box, TopLevelBoxHolder

public class BoxHolder
extends java.lang.Object
implements java.util.Iterator<java.lang.Object>

A BoxHolder is a container for JPEG 2000 boxes.

Author:
Gary McGath

Field Summary
protected  BoxHeader _boxHeader
           
protected  java.io.DataInputStream _dstrm
           
protected  Jpeg2000Module _module
           
protected  JP2Box _parentBox
           
protected  java.io.RandomAccessFile _raf
           
protected  RepInfo _repInfo
           
protected  long bytesLeft
           
protected  long filePos
           
protected  boolean hasBoxes
           
 
Constructor Summary
BoxHolder(java.io.RandomAccessFile raf)
          Constructor.
 
Method Summary
protected  long getFilePos()
          Returns the file position.
protected  java.lang.String getSelfPropName()
          Returns the name of the BoxHolder.
 boolean hasNext()
          Checks if any more subboxes are available.
 java.lang.Object next()
           
 void remove()
          Always throws UnsupportedOperationException.
protected  void superboxOverrun()
          Utility error reporting function for a subbox overrunning its superbox.
protected  void superboxUnderrun()
          Utility error reporting function for a subbox underrunning its superbox.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_module

protected Jpeg2000Module _module

_parentBox

protected JP2Box _parentBox

_raf

protected java.io.RandomAccessFile _raf

_dstrm

protected java.io.DataInputStream _dstrm

_boxHeader

protected BoxHeader _boxHeader

_repInfo

protected RepInfo _repInfo

bytesLeft

protected long bytesLeft

filePos

protected long filePos

hasBoxes

protected boolean hasBoxes
Constructor Detail

BoxHolder

public BoxHolder(java.io.RandomAccessFile raf)
Constructor.

Method Detail

getFilePos

protected long getFilePos()
Returns the file position. In practice, this means returning the beginning of the Box.


hasNext

public boolean hasNext()
Checks if any more subboxes are available. This class doesn't fully conform to the Iterator interface, as there are some cases where the lack of more boxes won't be detected till an EOF is encounterd. So callers should call hasNext to avoid reading overruns, and then test the value returned by next for nullity.

Specified by:
hasNext in interface java.util.Iterator<java.lang.Object>

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator<java.lang.Object>

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Always throws UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator<java.lang.Object>
Throws:
java.lang.UnsupportedOperationException

superboxOverrun

protected void superboxOverrun()
Utility error reporting function for a subbox overrunning its superbox. Sets the RepInfo's wellFormed flag to false.


superboxUnderrun

protected void superboxUnderrun()
Utility error reporting function for a subbox underrunning its superbox. Sets the RepInfo's wellFormed flag to false.


getSelfPropName

protected java.lang.String getSelfPropName()
Returns the name of the BoxHolder. All subclasses should override this.