Methods Summary |
---|
protected void | fillFields(org.apache.poi.hssf.record.RecordInputStream in)UTF8:
sid + len + bof + flags + len(str) + unicode + str
2 + 2 + 4 + 2 + 1 + 1 + len(str)
UNICODE:
sid + len + bof + flags + len(str) + unicode + str
2 + 2 + 4 + 2 + 1 + 1 + 2 * len(str)
field_1_position_of_BOF = in.readInt(); // bof
field_2_option_flags = in.readShort(); // flags
field_3_sheetname_length = in.readByte(); // len(str)
field_4_compressed_unicode_flag = in.readByte(); // unicode
int nameLength = LittleEndian.ubyteToInt( field_3_sheetname_length );
if ( ( field_4_compressed_unicode_flag & 0x01 ) == 1 )
{
field_5_sheetname = in.readUnicodeLEString(nameLength);
}
else
{
field_5_sheetname = in.readCompressedUnicode(nameLength);
}
|
public byte | getCompressedUnicodeFlag()get whether or not to interperate the Sheetname as compressed unicode (8/16 bit)
(This is undocumented but can be found as Q187919 on the Microsoft(tm) Support site)
return field_4_compressed_unicode_flag;
|
public short | getOptionFlags()get the option flags (unimportant for HSSF supported sheets)
return field_2_option_flags;
|
public int | getPositionOfBof()get the offset in bytes of the Beginning of File Marker within the HSSF Stream part of the POIFS file
return field_1_position_of_BOF;
|
public byte | getRawSheetnameLength()get the length of the raw sheetname in characters
the length depends on the unicode flag
return (byte) ( ( ( field_4_compressed_unicode_flag & 0x01 ) == 1 )
? 2 * field_3_sheetname_length
: field_3_sheetname_length );
|
public int | getRecordSize()
// Includes sid length + size length
return 12 + getRawSheetnameLength();
|
public java.lang.String | getSheetname()get the sheetname for this sheet. (this appears in the tabs at the bottom)
return field_5_sheetname;
|
public byte | getSheetnameLength()get the length of the sheetname in characters
return field_3_sheetname_length;
|
public short | getSid()
return sid;
|
public int | serialize(int offset, byte[] data)
LittleEndian.putShort( data, 0 + offset, sid );
LittleEndian.putShort( data, 2 + offset, (short) ( 8 + getRawSheetnameLength() ) );
LittleEndian.putInt( data, 4 + offset, getPositionOfBof() );
LittleEndian.putShort( data, 8 + offset, getOptionFlags() );
data[10 + offset] = (byte) ( getSheetnameLength() );
data[11 + offset] = getCompressedUnicodeFlag();
if ( ( field_4_compressed_unicode_flag & 0x01 ) == 1 )
StringUtil.putUnicodeLE( getSheetname(), data, 12 + offset );
else
StringUtil.putCompressedUnicode( getSheetname(), data, 12 + offset );
return getRecordSize();
/*
byte[] fake = new byte[] { (byte)0x85, 0x00, // sid
0x1a, 0x00, // length
0x3C, 0x09, 0x00, 0x00, // bof
0x00, 0x00, // flags
0x09, // len( str )
0x01, // unicode
// <str>
0x21, 0x04, 0x42, 0x04, 0x40, 0x04, 0x30, 0x04, 0x3D,
0x04, 0x38, 0x04, 0x47, 0x04, 0x3A, 0x04, 0x30, 0x04
// </str>
};
sid + len + bof + flags + len(str) + unicode + str
2 + 2 + 4 + 2 + 1 + 1 + len(str)
System.arraycopy( fake, 0, data, offset, fake.length );
return fake.length;
*/
|
public void | setCompressedUnicodeFlag(byte flag)set whether or not to interperate the Sheetname as compressed unicode (8/16 bit)
(This is undocumented but can be found as Q187919 on the Microsoft(tm) Support site)
field_4_compressed_unicode_flag = flag;
|
public void | setOptionFlags(short flags)set the option flags (unimportant for HSSF supported sheets)
field_2_option_flags = flags;
|
public void | setPositionOfBof(int pos)set the offset in bytes of the Beginning of File Marker within the HSSF Stream part of the POIFS file
field_1_position_of_BOF = pos;
|
public void | setSheetname(java.lang.String sheetname)Set the sheetname for this sheet. (this appears in the tabs at the bottom)
if ((sheetname == null) || (sheetname.length()==0)
|| (sheetname.length()>31)
|| (sheetname.indexOf("/") > -1)
|| (sheetname.indexOf("\\") > -1)
|| (sheetname.indexOf("?") > -1)
|| (sheetname.indexOf("*") > -1)
|| (sheetname.indexOf("]") > -1)
|| (sheetname.indexOf("[") > -1) ){
throw new IllegalArgumentException("Sheet name cannot be blank, greater than 31 chars, or contain any of /\\*?[]");
}
field_5_sheetname = sheetname;
setCompressedUnicodeFlag(StringUtil.hasMultibyte(sheetname) ? (byte)1 : (byte)0);
|
public void | setSheetnameLength(byte len)Set the length of the sheetname in characters
field_3_sheetname_length = len;
|
public java.lang.String | toString()
StringBuffer buffer = new StringBuffer();
buffer.append( "[BOUNDSHEET]\n" );
buffer.append( " .bof = " )
.append( Integer.toHexString( getPositionOfBof() ) ).append( "\n" );
buffer.append( " .optionflags = " )
.append( Integer.toHexString( getOptionFlags() ) ).append( "\n" );
buffer.append( " .sheetname length= " )
.append( Integer.toHexString( getSheetnameLength() ) ).append( "\n" );
buffer.append( " .unicodeflag = " )
.append( Integer.toHexString( getCompressedUnicodeFlag() ) )
.append( "\n" );
buffer.append( " .sheetname = " ).append( getSheetname() )
.append( "\n" );
buffer.append( "[/BOUNDSHEET]\n" );
return buffer.toString();
|
protected void | validateSid(short id)
if ( id != sid )
{
throw new RecordFormatException( "NOT A Bound Sheet RECORD" );
}
|