net.jqhome.jwps.ea
Class MVMTEA

java.lang.Object
  |
  +--net.jqhome.jwps.ea.AbstractEA
        |
        +--net.jqhome.jwps.ea.EAVector
              |
              +--net.jqhome.jwps.ea.MVMTEA
Direct Known Subclasses:
CommentsEA, MVSTEA, StringMVMT, VersionEA

public class MVMTEA
extends EAVector

This is a list of EAs (the MV = 'mutli-valued' part of the name) and these may be of any type ( MT = 'multi-type'). These may be nested in any way and the only limit is size.


Nested Class Summary
 class MVMTEA.FoundEA
          An inner class used for parsing RawEA objects.
 
Field Summary
 
Fields inherited from class net.jqhome.jwps.ea.EAVector
EA_CODEPAGE_INDEX, EA_COUNT_INDEX, EA_TYPE_INDEX, MVMT_DATA_CONTROL_BLOCK_LENGTH, MVMT_DATA_LENGTH_OFFSET, MVMT_DATA_OFFSET, MVMT_DATA_START_INDEX, MVMT_DATA_TYPE_OFFSET, MVST_DATA_CONTROL_BLOCK_LENGTH, MVST_DATA_LENGTH_OFFSET, MVST_DATA_OFFSET, MVST_DATA_START_INDEX, MVST_TYPE_INDEX
 
Fields inherited from class net.jqhome.jwps.ea.AbstractEA
EA_NAME_ASSOCIATION_TABLE, EA_NAME_CODEPAGE, EA_NAME_COMMENTS, EA_NAME_HISTORY, EA_NAME_ICON, EA_NAME_ICON1, EA_NAME_KEYPHRASES, EA_NAME_LONGNAME, EA_NAME_SUBJECT, EA_NAME_TYPE, EA_NAME_VERSION, XML_EA_B64_ENCODING, XML_EA_CODEPAGE_TAGNAME, XML_EA_ENCODING_TYPE_TAGNAME, XML_EA_FILE_TAGNAME, XML_EA_IS_CRITICAL_TAGNAME, XML_EA_LIST_TAGNAME, XML_EA_NAME_TAGNAME, XML_EA_TAGNAME, XML_EA_TEXT_ENCODING, XML_EA_TYPE_TAGNAME, XML_EA_VALUE_TAGNAME
 
Constructor Summary
MVMTEA()
          Default constructor.
MVMTEA(RawEA rawEA)
          Constructor to make this EA from a wrappered byte array.
MVMTEA(java.lang.String name)
          This is a convenience constructor.
MVMTEA(java.lang.String name, boolean isCritical)
          Constructor to set the name and if it is critical.
MVMTEA(java.lang.String name, int type, boolean isCritical)
          Constructor to set the name, type and if it si critical.
 
Method Summary
 void fromRawEA(RawEA rawEA)
          Converts this into a wrappered byte array.
protected  MVMTEA.FoundEA getEA(byte[] ba, int startIndex)
          Part of the mechanism for decoding raw EAs.
protected  int getEntryType(byte[] ba, int startIndex)
          This returns the numeric type of the entry for the MVMT EA.
protected  MVMTEA.FoundEA getMVEA2(byte[] ba, int startIndex)
          This will locate the next multi-valued EA.
protected  int getMVMTCount(byte[] ba, int startIndex)
          This returns the number of entries this MVMT thinks it has.
 int getRawEASize()
          Returns the size of all the wrappered EAs.
protected  int getSTEntryLength(byte[] ba, int startIndex)
          Gets the length of the next simple EA.
protected  MVMTEA.FoundEA getSVEA2(byte[] ba, int startIndex)
          Locates the next simple EA (string or binary).
protected  void mvmtSetup(RawEA rawEA)
          This is where the actual work is done to process a raw EA.
 RawEA toRawEA()
          Converts this into a wrappered byte array.
 java.lang.String toString()
          A report on the contents of this EA.
 int valueSize()
          This computes the total number of bytes in the actual value of this EA.
 
Methods inherited from class net.jqhome.jwps.ea.EAVector
addEA, addEA, addEA, equals, getCodepage, getEAAt, getEACodepage, getEACount, getEAType, getVector, isDefaultCodepage, removeEAAt, setCodepage, size, toXML
 
Methods inherited from class net.jqhome.jwps.ea.AbstractEA
fileToBytes, getName, getType, isCritical, isUserDefined, setCritical, setName, setType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MVMTEA

public MVMTEA(RawEA rawEA)
       throws JWPException
Constructor to make this EA from a wrappered byte array. Chiefly used by EAFactory.

Parameters:
rawEA - the wrappered byte array
Throws:
JWPException - if the numeric type of this object cannot be determined or if the creation of one of its sub-EAs fails.

MVMTEA

public MVMTEA()
       throws JWPException
Default constructor. This only sets the numeric type.

Throws:
JWPException - if an error occured in the superclass.

MVMTEA

public MVMTEA(java.lang.String name)
       throws JWPException
This is a convenience constructor. It makes a new MVMT EA with the default codepage, type of an MVMT and marks it as non-critical.

Throws:
JWPException - if an error occured in the superclass

MVMTEA

public MVMTEA(java.lang.String name,
              int type,
              boolean isCritical)
       throws JWPException
Constructor to set the name, type and if it si critical. Mostly used by subclasses.

Parameters:
name - the name of this EA
type - the numeric type
isCritical - true if this is to be a critical EA

MVMTEA

public MVMTEA(java.lang.String name,
              boolean isCritical)
       throws JWPException
Constructor to set the name and if it is critical. The numeric type is set to EAT_MVMT.

Parameters:
name - the name of the EA
isCritical - true if this EA is to be a critical EA.
Method Detail

fromRawEA

public void fromRawEA(RawEA rawEA)
               throws JWPException
Converts this into a wrappered byte array.

Specified by:
fromRawEA in class AbstractEA
Parameters:
rawEA - the wrappered byte array to process
Throws:
JWPException - if an error processing the raw EA occurs.

valueSize

public int valueSize()
Description copied from class: AbstractEA
This computes the total number of bytes in the actual value of this EA. So for example, for a string EA that is just the length. This is not the same value as might be returned from issuing call to getEASize() in FileEA. This is because there are additional control bytes that the system requires.

Specified by:
valueSize in class AbstractEA

getRawEASize

public int getRawEASize()
Returns the size of all the wrappered EAs. This is intended to be used in creating raw EAs.

Specified by:
getRawEASize in class AbstractEA
Returns:
int the size of all raw EA, plus this EA. Exactly the number of bytes need.

getEA

protected MVMTEA.FoundEA getEA(byte[] ba,
                               int startIndex)
                        throws JWPException
Part of the mechanism for decoding raw EAs. This will snoop for recognizeable structures within the byte array beginning at a given index.

Parameters:
ba - the byte array
startIndex - where the start the search
Throws:
JWPException - if looking for an EA fails to find one

getSVEA2

protected MVMTEA.FoundEA getSVEA2(byte[] ba,
                                  int startIndex)
                           throws JWPException
Locates the next simple EA (string or binary).

Parameters:
ba - the byte array to search
startIndex - the index from which to start the search
Returns:
FoundEA the found EA.
Throws:
JWPException - if there is a problem locating the EA or if the byte array if corrupt

getMVEA2

protected MVMTEA.FoundEA getMVEA2(byte[] ba,
                                  int startIndex)
                           throws JWPException
This will locate the next multi-valued EA.

Parameters:
ba - byte array to search
startIndex - where to start the search
Returns:
FoundEA the found EA
Throws:
JWPException - if the multi-valued EA could not be located or if the byte array if corrupt.

toRawEA

public RawEA toRawEA()
              throws JWPException
Converts this into a wrappered byte array.

Specified by:
toRawEA in class AbstractEA
Returns:
RawEA the wrappered byte array
Throws:
JWPException - if there is a problem creating it.

getSTEntryLength

protected int getSTEntryLength(byte[] ba,
                               int startIndex)
Gets the length of the next simple EA.

Parameters:
ba - byte array to search
startIndex - where to start
Returns:
int the length. No checking is done here for validity.

getEntryType

protected int getEntryType(byte[] ba,
                           int startIndex)
This returns the numeric type of the entry for the MVMT EA.

Parameters:
ba - byte array to process
startIndex - where to start the search
Returns:
the type. No checking is done here for validity.

getMVMTCount

protected int getMVMTCount(byte[] ba,
                           int startIndex)
This returns the number of entries this MVMT thinks it has.

Parameters:
ba - byte array to process
startIndex - where to start the search
Returns:
the type. No checking is done here for validity.

mvmtSetup

protected void mvmtSetup(RawEA rawEA)
                  throws JWPException
This is where the actual work is done to process a raw EA.

Parameters:
rawEA - the wrappered byte array
Throws:
JWPException - if there is an error processing this EA.

toString

public java.lang.String toString()
A report on the contents of this EA.

Overrides:
toString in class EAVector