/** * InputStream <tt>in</tt> is expected to contain: * <ol> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> * </ol> * For this encoding, the is16BitFlag is always present even if nChars==0. * <br> * This method should be used when the nChars field is <em>not</em> stored * as a ushort immediately before the is16BitFlag. Otherwise, {@link * #readUnicodeString(LittleEndianInput)} can be used. */ public static String readUnicodeString(LittleEndianInput in, int nChars) { byte is16Bit = in.readByte(); if ((is16Bit & 0x01) == 0) { return readCompressedUnicode(in, nChars); } return readUnicodeLE(in, nChars); }
/** Create a StringPtg from a stream */ public StringPtg(LittleEndianInput in) { int nChars = in.readUByte(); // Note - nChars is 8-bit _is16bitUnicode = (in.readByte() & 0x01) != 0; if (_is16bitUnicode) { field_3_string = StringUtil.readUnicodeLE(in, nChars); } else { field_3_string = StringUtil.readCompressedUnicode(in, nChars); } }
public static String readUnicodeLPP4(LittleEndianInput is) { int length = is.readInt(); if (length%2 != 0) { throw new EncryptedDocumentException( "UNICODE-LP-P4 structure is a multiple of 4 bytes. " + "If Padding is present, it MUST be exactly 2 bytes long"); } String result = StringUtil.readUnicodeLE(is, length/2); if (length%4==2) { // Padding (variable): A set of bytes that MUST be of the correct size such that the size of the // UNICODE-LP-P4 structure is a multiple of 4 bytes. If Padding is present, it MUST be exactly // 2 bytes long, and each byte MUST be 0x00. is.readShort(); } return result; }
/** * InputStream <tt>in</tt> is expected to contain: * <ol> * <li>ushort nChars</li> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> * </ol> * For this encoding, the is16BitFlag is always present even if nChars==0. * <p> * This structure is also known as a XLUnicodeString. */ public static String readUnicodeString(LittleEndianInput in) { int nChars = in.readUShort(); byte flag = in.readByte(); if ((flag & 0x01) == 0) { return readCompressedUnicode(in, nChars); } return readUnicodeLE(in, nChars); }
/** * @param ris the RecordInputstream to read the record from */ public NameCommentRecord(final RecordInputStream ris) { field_1_record_type = ris.readShort(); field_2_frt_cell_ref_flag = ris.readShort(); field_3_reserved = ris.readLong(); final int field_4_name_length = ris.readShort(); final int field_5_comment_length = ris.readShort(); if (ris.readByte() == 0) { field_6_name_text = StringUtil.readCompressedUnicode(ris, field_4_name_length); } else { field_6_name_text = StringUtil.readUnicodeLE(ris, field_4_name_length); } if (ris.readByte() == 0) { field_7_comment_text = StringUtil.readCompressedUnicode(ris, field_5_comment_length); } else { field_7_comment_text = StringUtil.readUnicodeLE(ris, field_5_comment_length); } }
/** * Read the record data from the supplied <code>RecordInputStream</code> * * @param in the RecordInputStream to read from */ public NoteRecord(RecordInputStream in) { field_1_row = in.readUShort(); field_2_col = in.readShort(); field_3_flags = in.readShort(); field_4_shapeid = in.readUShort(); int length = in.readShort(); field_5_hasMultibyte = in.readByte() != 0x00; if (field_5_hasMultibyte) { field_6_author = StringUtil.readUnicodeLE(in, length); } else { field_6_author = StringUtil.readCompressedUnicode(in, length); } if (in.available() == 1) { field_7_padding = Byte.valueOf(in.readByte()); } else if (in.available() == 2 && length == 0) { // If there's no author, may be double padded field_7_padding = Byte.valueOf(in.readByte()); in.readByte(); } }
rawText = StringUtil.readCompressedUnicode(in, nChars); } else { rawText = StringUtil.readUnicodeLE(in, nChars);
public StyleRecord(RecordInputStream in) { field_1_xf_index = in.readShort(); if (isBuiltin()) { field_2_builtin_style = in.readByte(); field_3_outline_style_level = in.readByte(); } else { int field_2_name_length = in.readShort(); if(in.remaining() < 1) { // Some files from Crystal Reports lack the is16BitUnicode byte // the remaining fields, which is naughty if (field_2_name_length != 0) { throw new RecordFormatException("Ran out of data reading style record"); } // guess this is OK if the string length is zero field_4_name = ""; } else { field_3_stringHasMultibyte = in.readByte() != 0x00; if (field_3_stringHasMultibyte) { field_4_name = StringUtil.readUnicodeLE(in, field_2_name_length); } else { field_4_name = StringUtil.readCompressedUnicode(in, field_2_name_length); } } } }
); phoneticText = StringUtil.readUnicodeLE(in, length1);
entry.streamName = StringUtil.readUnicodeLE(leis, nameSize); leis.readShort(); assert(entry.streamName.length() == nameSize);
stringByteCount += LittleEndian.BYTE_SIZE; if (field_3_unicode_flag) { field_4_ole_classname = StringUtil.readUnicodeLE(in, nChars); stringByteCount += nChars * 2; } else {
} else { if (field_11_nameIsMultibyte) { field_12_name_text = StringUtil.readUnicodeLE(in, field_3_length_name_text); } else { field_12_name_text = StringUtil.readCompressedUnicode(in, field_3_length_name_text);
_address = StringUtil.readUnicodeLE(in, charDataSize/2); } else { _address = null;
/** * InputStream <tt>in</tt> is expected to contain: * <ol> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> * </ol> * For this encoding, the is16BitFlag is always present even if nChars==0. * <br> * This method should be used when the nChars field is <em>not</em> stored * as a ushort immediately before the is16BitFlag. Otherwise, {@link * #readUnicodeString(LittleEndianInput)} can be used. */ public static String readUnicodeString(LittleEndianInput in, int nChars) { byte is16Bit = in.readByte(); if ((is16Bit & 0x01) == 0) { return readCompressedUnicode(in, nChars); } return readUnicodeLE(in, nChars); }
/** Create a StringPtg from a stream */ public StringPtg(LittleEndianInput in) { int nChars = in.readUByte(); // Note - nChars is 8-bit _is16bitUnicode = (in.readByte() & 0x01) != 0; if (_is16bitUnicode) { field_3_string = StringUtil.readUnicodeLE(in, nChars); } else { field_3_string = StringUtil.readCompressedUnicode(in, nChars); } }
/** Create a StringPtg from a stream */ public StringPtg(LittleEndianInput in) { int nChars = in.readUByte(); // Note - nChars is 8-bit _is16bitUnicode = (in.readByte() & 0x01) != 0; if (_is16bitUnicode) { field_3_string = StringUtil.readUnicodeLE(in, nChars); } else { field_3_string = StringUtil.readCompressedUnicode(in, nChars); } }
/** Create a StringPtg from a stream */ public StringPtg(LittleEndianInput in) { int nChars = in.readUByte(); // Note - nChars is 8-bit _is16bitUnicode = (in.readByte() & 0x01) != 0; if (_is16bitUnicode) { field_3_string = StringUtil.readUnicodeLE(in, nChars); } else { field_3_string = StringUtil.readCompressedUnicode(in, nChars); } }
public static String readUnicodeLPP4(LittleEndianInput is) { int length = is.readInt(); if (length%2 != 0) { throw new EncryptedDocumentException( "UNICODE-LP-P4 structure is a multiple of 4 bytes. " + "If Padding is present, it MUST be exactly 2 bytes long"); } String result = StringUtil.readUnicodeLE(is, length/2); if (length%4==2) { // Padding (variable): A set of bytes that MUST be of the correct size such that the size of the // UNICODE-LP-P4 structure is a multiple of 4 bytes. If Padding is present, it MUST be exactly // 2 bytes long, and each byte MUST be 0x00. is.readShort(); } return result; }
/** * InputStream <tt>in</tt> is expected to contain: * <ol> * <li>ushort nChars</li> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> * </ol> * For this encoding, the is16BitFlag is always present even if nChars==0. * <p> * This structure is also known as a XLUnicodeString. */ public static String readUnicodeString(LittleEndianInput in) { int nChars = in.readUShort(); byte flag = in.readByte(); if ((flag & 0x01) == 0) { return readCompressedUnicode(in, nChars); } return readUnicodeLE(in, nChars); }
/** * Read the record data from the supplied <code>RecordInputStream</code> */ public NoteRecord(RecordInputStream in) { field_1_row = in.readUShort(); field_2_col = in.readShort(); field_3_flags = in.readShort(); field_4_shapeid = in.readUShort(); int length = in.readShort(); field_5_hasMultibyte = in.readByte() != 0x00; if (field_5_hasMultibyte) { field_6_author = StringUtil.readUnicodeLE(in, length); } else { field_6_author = StringUtil.readCompressedUnicode(in, length); } if (in.available() == 1) { field_7_padding = Byte.valueOf(in.readByte()); } }