MarkerSegment (JHOVE Documentation)
Date: 2013-09-08

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.harvard.hul.ois.jhove.module.jpeg2000
Class MarkerSegment

    java.lang.Object
      edu.harvard.hul.ois.jhove.module.jpeg2000.MarkerSegment

Direct Known Subclasses:
  COCMarkerSegment, CODMarkerSegment, CommentMarkerSegment, CRGMarkerSegment, DefaultMarkerSegment, Marker, PLMMarkerSegment, PLTMarkerSegment, POCMarkerSegment, PPMMarkerSegment, PPTMarkerSegment, QCCMarkerSegment, QCDMarkerSegment, RGNMarkerSegment, SIZMarkerSegment, SOTMarkerSegment, TLMMarkerSegment

    public abstract class MarkerSegment

extends java.lang.Object

Abstract superclass for marker segments.

Author:
  Gary McGath

Field Summary
`protected ContCodestream` | `_ccs`
`protected Codestream` | `_cs`
`protected java.io.DataInputStream` | `_dstream`
`protected Jpeg2000Module` | `_module`
`protected RepInfo` | `_repInfo`
`protected static int` | `COC`
`protected static int` | `COD`
`protected static int` | `COM`
`protected static int` | `CRG`
`protected static int` | `EOC`
`protected static int` | `EPH`
`protected static int` | `PLM`
`protected static int` | `PLT`
`protected static int` | `POC`
`protected static int` | `PPM`
`protected static int` | `PPT`
`protected static int` | `QCC`
`protected static int` | `QCD`
`protected static int` | `RGN`
`protected static int` | `SIZ`
`protected static int` | `SOC`
`protected static int` | `SOD`
`protected static int` | `SOP`
`protected static int` | `SOT`
`protected static int` | `TLM`

Constructor Summary
`MarkerSegment()` Constructor.

Method Summary
`protected MainOrTile` | `getMainOrTile()` Returns the MainOrTile object which is currently applicable in the Contiguous Codestream.
`boolean` | `isMarker()` Returns `true` if this segment is a Marker.
`protected static MarkerSegment` | `markerSegmentMaker(int markerCode)` Static factory method for generating an object of the appropriate subclass of MarkerSegment, based on the marker code.
`protected int` | `nCompBytes()` Determines size of fields indexed by number of components.
`protected abstract boolean` | `process(int bytesToEat)` Process the marker or marker segment.
`protected int` | `readMarkLen()` Reads and returns the length field of the marker segment.
`void` | `setCodestream(Codestream cs)` Sets the Codestream object being built.
`void` | `setContCodestream(ContCodestream ccs)` Sets the Continuous Codestream from which this marker was obtained.
`void` | `setDataInputStream(java.io.DataInputStream dstream)` Sets the DataInputStream over which this marker is being read.
`void` | `setModule(Jpeg2000Module module)` Sets the Module under which all this is happening.
`void` | `setRepInfo(RepInfo repInfo)` Sets the RepInfo into which messages may be placed.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SOC

    protected static final int SOC

See Also:
  Constant Field Values

### COD

    protected static final int COD

See Also:
  Constant Field Values

### COC

    protected static final int COC

See Also:
  Constant Field Values

### TLM

    protected static final int TLM

See Also:
  Constant Field Values

### PLM

    protected static final int PLM

See Also:
  Constant Field Values

### PLT

    protected static final int PLT

See Also:
  Constant Field Values

### QCD

    protected static final int QCD

See Also:
  Constant Field Values

### QCC

    protected static final int QCC

See Also:
  Constant Field Values

### RGN

    protected static final int RGN

See Also:
  Constant Field Values

### POC

    protected static final int POC

See Also:
  Constant Field Values

### PPM

    protected static final int PPM

See Also:
  Constant Field Values

### PPT

    protected static final int PPT

See Also:
  Constant Field Values

### CRG

    protected static final int CRG

See Also:
  Constant Field Values

### COM

    protected static final int COM

See Also:
  Constant Field Values

### SOT

    protected static final int SOT

See Also:
  Constant Field Values

### SOP

    protected static final int SOP

See Also:
  Constant Field Values

### EPH

    protected static final int EPH

See Also:
  Constant Field Values

### SOD

    protected static final int SOD

See Also:
  Constant Field Values

### EOC

    protected static final int EOC

See Also:
  Constant Field Values

### SIZ

    protected static final int SIZ

See Also:
  Constant Field Values

### _ccs

    protected ContCodestream _ccs

### _cs

    protected Codestream _cs

### _module

    protected Jpeg2000Module _module

### _dstream

    protected java.io.DataInputStream _dstream

### _repInfo

    protected RepInfo _repInfo

Constructor Detail

### MarkerSegment

    public MarkerSegment()

  Constructor. After an instance of a MarkerSegment is created, the setter methods `setContCodestream`, `setCodestream`, `setModule`, and `setDataInputStream` must all be called as part of the setup before `process` is called.

Method Detail

### setContCodestream

    public void setContCodestream(ContCodestream ccs)

  Sets the Continuous Codestream from which this marker was obtained.

### setCodestream

    public void setCodestream(Codestream cs)

  Sets the Codestream object being built.

### setModule

    public void setModule(Jpeg2000Module module)

  Sets the Module under which all this is happening.

### setDataInputStream

    public void setDataInputStream(java.io.DataInputStream dstream)

  Sets the DataInputStream over which this marker is being read.

### setRepInfo

    public void setRepInfo(RepInfo repInfo)

  Sets the RepInfo into which messages may be placed.

### isMarker

    public boolean isMarker()

  Returns `true` if this segment is a Marker. Will return `false` unless overridden.

### markerSegmentMaker

    protected static MarkerSegment markerSegmentMaker(int markerCode)

  Static factory method for generating an object of the appropriate subclass of MarkerSegment, based on the marker code.

  Parameters:
    `markerCode` - The 8-bit marker code (ignoring the FF).

### readMarkLen

    protected int readMarkLen()
                       throws java.io.IOException

  Reads and returns the length field of the marker segment. The setter methods `setModule` and `setDataInputStream` must be called as part of the setup before `readMarkLen` is called.

  Throws:
    `java.io.IOException`

### nCompBytes

    protected int nCompBytes()

  Determines size of fields indexed by number of components. Some marker segments have fields which are 1 byte long if the number of components is 1-255, and 2 bytes long if the number of components is 256-65535.

  Returns:
    0 if number of components not yet set, otherwise 1 or 2

### getMainOrTile

    protected MainOrTile getMainOrTile()

  Returns the MainOrTile object which is currently applicable in the Contiguous Codestream. If the Contiguous Codestream has a current Tile, that is returned; otherwise the Codestream object established by setCodestream is returned.

### process

    protected abstract boolean process(int bytesToEat)
                                throws java.io.IOException

  Process the marker or marker segment. The DataInputStream will be at the point of having read the marker code. The `process` method must consume exactly the number of bytes remaining in the marker segment; for a marker, this number will always be 0.

  Parameters:
    `bytesToEat` - The number of bytes that must be consumed. For a Marker, this number will always be 0. If it is 0 for a MarkerSegment, the number of bytes to consume is unknown.
  Returns:
    `true` if segment is well-formed, `false` otherwise.
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD