FileDocCategorySizeDatePackage
MMSRecord.javaAPI DocApache Poi 3.0.14033Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record

MMSRecord

public class MMSRecord extends Record
Title: MMS Record

Description: defines how many add menu and del menu options are stored in the file. Should always be set to 0 for HSSF workbooks

REFERENCE: PG 328 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

author
Andrew C. Oliver (acoliver at apache dot org)
version
2.0-pre

Fields Summary
public static final short
sid
private byte
field_1_addMenuCount
private byte
field_2_delMenuCount
Constructors Summary
public MMSRecord()

   // = 0;

     
    
    
public MMSRecord(RecordInputStream in)
Constructs a MMS record and sets its fields appropriately.

param
id id must be 0xc1 or an exception will be throw upon validation
param
size the size of the data area of the record
param
data data of the record (should not contain sid/len)

        super(in);
    
Methods Summary
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_addMenuCount = in.readByte();
        field_2_delMenuCount = in.readByte();
    
public bytegetAddMenuCount()
get number of add menu options (should be 0)

return
number of add menu options

        return field_1_addMenuCount;
    
public bytegetDelMenuCount()
get number of add del options (should be 0)

return
number of add menu options

        return field_2_delMenuCount;
    
public intgetRecordSize()

        return 6;
    
public shortgetSid()

        return sid;
    
public intserialize(int offset, byte[] data)

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset,
                              (( short ) 0x02));   // 2 bytes (6 total)
        data[ 4 + offset ] = getAddMenuCount();
        data[ 5 + offset ] = getDelMenuCount();
        return getRecordSize();
    
public voidsetAddMenuCount(byte am)
set number of add menu options (set to 0)

param
am number of add menu options

        field_1_addMenuCount = am;
    
public voidsetDelMenuCount(byte dm)
set number of del menu options (set to 0)

param
dm number of del menu options

        field_2_delMenuCount = dm;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[MMS]\n");
        buffer.append("    .addMenu        = ")
            .append(Integer.toHexString(getAddMenuCount())).append("\n");
        buffer.append("    .delMenu        = ")
            .append(Integer.toHexString(getDelMenuCount())).append("\n");
        buffer.append("[/MMS]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)

        if (id != sid)
        {
            throw new RecordFormatException("NOT A MMS RECORD");
        }