Methods Summary |
---|
public java.lang.Object | clone()
FooterRecord rec = new FooterRecord();
rec.field_1_footer_len = field_1_footer_len;
rec.field_2_reserved = field_2_reserved;
rec.field_3_unicode_flag = field_3_unicode_flag;
rec.field_4_footer = field_4_footer;
return rec;
|
protected void | fillFields(org.apache.poi.hssf.record.RecordInputStream in)
if (in.remaining() > 0)
{
field_1_footer_len = in.readByte();
/** These two fields are a bit odd. They are not documented*/
field_2_reserved = in.readByte();
field_3_unicode_flag = in.readByte(); // unicode
if(isMultibyte())
{
field_4_footer = in.readUnicodeLEString(LittleEndian.ubyteToInt( field_1_footer_len));
}
else
{
field_4_footer = in.readCompressedUnicode(LittleEndian.ubyteToInt( field_1_footer_len));
}
}
|
public java.lang.String | getFooter()get the footer string
return field_4_footer;
|
public short | getFooterLength()get the length of the footer string
return (short)(0xFF & field_1_footer_len); // [Shawn] Fixed needing unsigned byte
|
public int | getRecordSize()
int retval = 4;
if (getFooterLength() > 0)
{
retval+=3; // [Shawn] Fixed for two null bytes in the length
}
return (isMultibyte() ?
(retval + getFooterLength()*2) : (retval + getFooterLength()));
|
public short | getSid()
return sid;
|
public boolean | isMultibyte()see the unicode flag
return ((field_3_unicode_flag & 0xFF) == 1);
|
public int | serialize(int offset, byte[] data)
int len = 4;
if (getFooterLength() > 0)
{
len+=3; // [Shawn] Fixed for two null bytes in the length
}
short bytelen = (short)(isMultibyte() ?
getFooterLength()*2 : getFooterLength() );
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset,
( short ) ((len - 4) + bytelen ));
if (getFooterLength() > 0)
{
data[ 4 + offset ] = (byte)getFooterLength();
data[ 6 + offset ] = field_3_unicode_flag;
if(isMultibyte())
{
StringUtil.putUnicodeLE(getFooter(), data, 7 + offset);
}
else
{
StringUtil.putCompressedUnicode(getFooter(), data, 7 + offset); // [Shawn] Place the string in the correct offset
}
}
return getRecordSize();
|
public void | setFooter(java.lang.String footer)set the footer string
field_4_footer = footer;
field_3_unicode_flag =
(byte) (StringUtil.hasMultibyte(field_4_footer) ? 1 : 0);
|
public void | setFooterLength(byte len)set the length of the footer string
field_1_footer_len = len;
|
public java.lang.String | toString()
StringBuffer buffer = new StringBuffer();
buffer.append("[FOOTER]\n");
buffer.append(" .footerlen = ")
.append(Integer.toHexString(getFooterLength())).append("\n");
buffer.append(" .footer = ").append(getFooter())
.append("\n");
buffer.append("[/FOOTER]\n");
return buffer.toString();
|
protected void | validateSid(short id)
if (id != sid)
{
throw new RecordFormatException("NOT A FooterRECORD");
}
|