|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.hul.ois.jhove.ModuleBase
edu.harvard.hul.ois.jhove.module.Jpeg2000Module
public class Jpeg2000Module
Module for identification and validation of JPEG 2000 files. Code is included for JPX, but is almost entirely untested due to the lack of available sample files that use more than a tiny fraction of the features. The current version of the module is based on the typo-laden and inconsisent "JPEG 2000 Part II Final Committee Draft" (7 December 2000). The final standard (5 May 2004) has just reached our hands, and this code will be reviewed against it and revised accordingly in the near future. (All opinions expressed in this paragraph are those of the programmer.) JPEG 2000 format is not JPEG format, and isn't compatible with it. As with JPEG, JPEG 2000 is not in itself a file format. It can be encapsulated in JP2 or JPX format, which are recognized here.
Field Summary | |
---|---|
protected NisoImageMetadata |
_defaultNiso
|
protected java.io.DataInputStream |
_dstream
|
protected NisoImageMetadata |
_niso
PRIVATE INSTANCE FIELDS. |
protected java.util.List<Property> |
_propList
|
protected java.io.RandomAccessFile |
_raf
|
protected RAFInputStream |
_rafStream
|
protected java.util.List<Property> |
associationProps
|
protected java.util.List<Property> |
binaryFilterProps
|
protected java.util.List<Codestream> |
codestreams
|
protected java.util.List<Property> |
colorSpecs
|
protected boolean |
colorSpecSeen
|
protected java.util.List<Property> |
composLayers
|
protected Codestream |
curCodestream
|
protected java.util.List<Property> |
digitalSigProps
|
protected boolean |
filterMode
|
protected boolean |
imageHeaderSeen
|
protected boolean |
jp2Compliant
|
protected boolean |
jp2HdrSeen
|
protected boolean |
jpxCompliant
|
protected int |
nCodestreamHeaders
|
protected int |
nCodestreams
|
protected boolean |
rreqSeen
|
protected java.util.List<Property> |
uuidInfos
|
protected java.util.List<Property> |
uuids
|
protected java.util.List<java.lang.String> |
xmlList
|
Fields inherited from class edu.harvard.hul.ois.jhove.ModuleBase |
---|
_app, _bigEndian, _checksumFinished, _countStream, _coverage, _crc32, _date, _defaultParams, _features, _format, _init, _isRandomAccess, _je, _logger, _md5, _mimeType, _name, _nByte, _note, _param, _release, _repInfoNote, _rights, _sha1, _signature, _specification, _validityNote, _vendor, _verbosity, _wellFormedNote |
Fields inherited from interface edu.harvard.hul.ois.jhove.Module |
---|
MAXIMUM_VERBOSITY, MINIMUM_VERBOSITY |
Constructor Summary | |
---|---|
Jpeg2000Module()
Instantiate a JpegModule object. |
Method Summary | |
---|---|
void |
addAssociationProp(Property p)
Adds an association property to the metadata. |
void |
addBinaryFilterProp(Property p)
Adds a binary filter property to the metadata. |
void |
addColorSpec(Property p)
Adds a color spec property to the metadata. |
void |
addComposLayer(Property p)
Adds a Compositing Layer property to the list of Compositing Layer properties. |
void |
addDigitalSignatureProp(Property p)
Adds a digital signature property to the metadata. |
void |
addProperty(Property p)
Adds a property to the JPEG2000 metadata. |
void |
addUUID(Property p)
Adds a UUID property to the list of UUID properties. |
void |
addUUIDInfo(Property p)
Adds a UUIDInfo property to the list of UUIDInfo properties. |
void |
addXML(java.lang.String s)
Adds an XML string to the list of XML properties. |
Codestream |
getCodestream(int n)
Returns the nth Codestream , creating it if necessary,
and make it the current one. |
NisoImageMetadata |
getCurrentNiso()
Returns the current NisoImageMetadata object. |
NisoImageMetadata |
getDefaultNiso()
Returns the default NisoImageMetadata object. |
long |
getFilePos()
Return the current position in the module. |
int |
getNCodestreamHeaders()
Returns the codestream header count. |
int |
getNCodestreams()
Returns the codestream count. |
protected void |
initParse()
Initializes the state of the module for parsing. |
boolean |
isJP2HdrSeen()
|
void |
parse(java.io.RandomAccessFile raf,
RepInfo info)
Parse the content of a stream digital object and store the results in RepInfo. |
java.lang.String |
read4Chars(java.io.DataInputStream stream)
Reads 4 bytes and concatenates them into a String. |
protected boolean |
readBoxes(RepInfo info)
|
protected boolean |
readFileTypeBox(RepInfo info)
|
long |
readSignedLong(java.io.DataInputStream stream)
One-argument version of readSignedLong . |
long |
readUnsignedInt(java.io.DataInputStream stream)
One-argument version of readUnsignedInt . |
int |
readUnsignedShort(java.io.DataInputStream stream)
One-argument version of readUnsignedShort . |
void |
seek(long pos)
Seek to a new file position. |
void |
setColorSpecSeen(boolean b)
Set the flag indicating the color specification box has been seen. |
void |
setImageHeaderSeen(boolean b)
Set the flag indicating the color specification box has been seen. |
void |
setJP2Compliant(boolean b)
Sets a flag indicating JP2 compliance. |
void |
setJP2HdrSeen(boolean b)
Set the flag indicating that a JP2 header has been seen. |
void |
setJPXCompliant(boolean b)
Sets a flag indicating JPX compliance. |
void |
setNCodestreamHeaders(int n)
Sets the codestream header count. |
void |
setNCodestreams(int n)
Sets the codestream count. |
void |
setRReqSeen(boolean b)
Set the flag indicating the reader requirements box has been seen. |
protected boolean |
skipOverBox(BoxHeader hdr,
RepInfo info,
java.io.DataInputStream dstrm)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected NisoImageMetadata _niso
protected NisoImageMetadata _defaultNiso
protected java.io.DataInputStream _dstream
protected java.io.RandomAccessFile _raf
protected RAFInputStream _rafStream
protected java.util.List<Property> _propList
protected java.util.List<Codestream> codestreams
protected java.util.List<Property> binaryFilterProps
protected java.util.List<Property> associationProps
protected java.util.List<Property> digitalSigProps
protected int nCodestreams
protected int nCodestreamHeaders
protected java.util.List<Property> colorSpecs
protected java.util.List<Property> uuids
protected java.util.List<Property> composLayers
protected java.util.List<Property> uuidInfos
protected java.util.List<java.lang.String> xmlList
protected boolean jp2HdrSeen
protected boolean rreqSeen
protected boolean colorSpecSeen
protected boolean imageHeaderSeen
protected boolean jp2Compliant
protected boolean jpxCompliant
protected Codestream curCodestream
protected boolean filterMode
Constructor Detail |
---|
public Jpeg2000Module()
Method Detail |
---|
public final void parse(java.io.RandomAccessFile raf, RepInfo info) throws java.io.IOException
counted
argment to all read calls, so that we can compute relative
positions in the stream based on _nByte.
parse
in interface Module
parse
in class ModuleBase
raf
- A RandomAccessFile to be parsed.info
- A fresh (on the first call) RepInfo object
which will be modified
to reflect the results of the parsing
If multiple calls to parse
are made
on the basis of a nonzero value being returned,
the same RepInfo object should be passed with each
call.
java.io.IOException
public long getFilePos()
public void seek(long pos) throws java.io.IOException
java.io.IOException
public NisoImageMetadata getDefaultNiso()
public NisoImageMetadata getCurrentNiso()
public Codestream getCodestream(int n)
Codestream
, creating it if necessary,
and make it the current one. The value of nCodestreams
or nCodestreamHeaders
is not affected, even if a new Codestream
is created.
public int getNCodestreams()
public int getNCodestreamHeaders()
public boolean isJP2HdrSeen()
public void setNCodestreams(int n)
public void setNCodestreamHeaders(int n)
public void setJP2HdrSeen(boolean b)
public void setRReqSeen(boolean b)
public void setColorSpecSeen(boolean b)
public void setImageHeaderSeen(boolean b)
public void setJP2Compliant(boolean b)
true
, and the JPX
compliance flag is also true, set the MIME type
to "image/jpx".
public void setJPXCompliant(boolean b)
public void addProperty(Property p)
public void addColorSpec(Property p)
public void addBinaryFilterProp(Property p)
public void addAssociationProp(Property p)
public void addDigitalSignatureProp(Property p)
public void addUUID(Property p)
public void addUUIDInfo(Property p)
public void addComposLayer(Property p)
public void addXML(java.lang.String s)
public java.lang.String read4Chars(java.io.DataInputStream stream) throws java.io.IOException
java.io.IOException
public int readUnsignedShort(java.io.DataInputStream stream) throws java.io.IOException
readUnsignedShort
.
JPEG2000 is always big-endian, so readUnsignedShort can
unambiguously drop its endian argument.
java.io.IOException
public long readUnsignedInt(java.io.DataInputStream stream) throws java.io.IOException
readUnsignedInt
.
JPEG2000 is always big-endian, so readUnsignedInt can
unambiguously drop its endian argument.
java.io.IOException
public long readSignedLong(java.io.DataInputStream stream) throws java.io.IOException
readSignedLong
.
JPEG2000 is always big-endian, so readSignedLong can
unambiguously drop its endian argument.
java.io.IOException
protected void initParse()
initParse
in class ModuleBase
protected boolean readBoxes(RepInfo info) throws java.io.IOException
java.io.IOException
protected boolean readFileTypeBox(RepInfo info) throws java.io.IOException
java.io.IOException
protected boolean skipOverBox(BoxHeader hdr, RepInfo info, java.io.DataInputStream dstrm) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |