}
else
{
- field_5_sheetname = new String( data, 8 + offset, nameLength );
+ field_5_sheetname = StringUtil.getFromCompressedUnicode( data, 8 + offset, nameLength );
}
}
{
if (data[ 15 ] == 0)
{ // is compressed unicode
- field_11_font_name = new String(data, 16,
+ field_11_font_name = StringUtil.getFromCompressedUnicode(data, 16,
LittleEndian.ubyteToInt(field_10_font_name_len));
}
else
if (size > 0)
{
field_1_footer_len = data[ 0 + offset ];
- field_2_footer = new String(data, 3 + offset, // [Shawn] Changed 1 to 3 for offset of string
+ field_2_footer = StringUtil.getFromCompressedUnicode(data, 3 + offset, // [Shawn] Changed 1 to 3 for offset of string
LittleEndian.ubyteToInt( field_1_footer_len) );
}
}
}
else {
// not unicode
- field_4_formatstring = new String(data, 5 + offset, field_3_unicode_len );
+ field_4_formatstring = StringUtil.getFromCompressedUnicode(data, 5 + offset, field_3_unicode_len );
}
}
if (size > 0)
{
field_1_header_len = data[ 0 + offset ];
- field_2_header = new String(data, 3 + offset, // [Shawn] Changed 1 to 3 for offset of string
+ field_2_header = StringUtil.getFromCompressedUnicode(data, 3 + offset, // [Shawn] Changed 1 to 3 for offset of string
LittleEndian.ubyteToInt(field_1_header_len));
}
}
}
else
{
- field_6_value = new String(data, 9 + offset, getStringLength());
+ field_6_value = StringUtil.getFromCompressedUnicode(data, 9 + offset, getStringLength());
}
}
field_12_builtIn_name = data[ 15 + offset ];
}
- field_12_name_text = new String(data, 15 + offset,
+ field_12_name_text = StringUtil.getFromCompressedUnicode(data, 15 + offset,
LittleEndian.ubyteToInt(field_3_length_name_text));
int start_of_name_definition = 15 + field_3_length_name_text;
offset, start_of_name_definition);
int start_of_custom_menu_text = start_of_name_definition + field_4_length_name_definition;
- field_14_custom_menu_text = new String(data, start_of_custom_menu_text + offset,
+ field_14_custom_menu_text = StringUtil.getFromCompressedUnicode(data, start_of_custom_menu_text + offset,
LittleEndian.ubyteToInt(field_7_length_custom_menu));
int start_of_description_text = start_of_custom_menu_text + field_8_length_description_text;
- field_15_description_text = new String(data, start_of_description_text + offset,
+ field_15_description_text = StringUtil.getFromCompressedUnicode(data, start_of_description_text + offset,
LittleEndian.ubyteToInt(field_8_length_description_text));
int start_of_help_topic_text = start_of_description_text + field_9_length_help_topic_text;
- field_16_help_topic_text = new String(data, start_of_help_topic_text + offset,
+ field_16_help_topic_text = StringUtil.getFromCompressedUnicode(data, start_of_help_topic_text + offset,
LittleEndian.ubyteToInt(field_9_length_help_topic_text));
int start_of_status_bar_text = start_of_help_topic_text + field_10_length_status_bar_text;
- field_17_status_bar_text = new String(data, start_of_status_bar_text + offset,
+ field_17_status_bar_text = StringUtil.getFromCompressedUnicode(data, start_of_status_bar_text + offset,
LittleEndian.ubyteToInt(field_10_length_status_bar_text));
/*} */
}
}
else
{
- field_3_string = new String(data, 3 + offset, field_1_string_length);
+ field_3_string = StringUtil.getFromCompressedUnicode(data, 3 + offset, field_1_string_length);
}
}
else if (getType() == 0)
{
field_2_name_length = data[ 2 + offset ];
- field_3_name = new String(data, 3 + offset,
+ field_3_name = StringUtil.getFromCompressedUnicode(data, 3 + offset,
LittleEndian.ubyteToInt(field_2_name_length));
}
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_username = new String(data, 3 + offset, data.length - 4);
+ field_1_username = StringUtil.getFromCompressedUnicode(data, 3 + offset, data.length - 4);
}
/**
}
+ /**
+ * read compressed unicode(8bit)
+ *
+ * @author Toshiaki Kamoshida(kamoshida.toshiaki at future dot co dot jp)
+ *
+ * @param string byte array to read
+ * @param offset offset to read byte array
+ * @param len length to read byte array
+ * @return String generated String instance by reading byte array
+ */
+ public static String getFromCompressedUnicode(final byte[] string,
+ final int offset, final int len){
+ try{
+ return new String(string,offset,len,"ISO-8859-1");
+ }
+ catch(UnsupportedEncodingException e){
+ throw new InternalError();/* unreachable */
+ }
+ }
+
/**
* write compressed unicode
*