Java Code Examples for org.apache.poi.util.StringUtil#putUnicodeLE()
The following examples show how to use
org.apache.poi.util.StringUtil#putUnicodeLE() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StyleRecord.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public void serialize(LittleEndianOutput out) { out.writeShort(field_1_xf_index); if (isBuiltin()) { out.writeByte(field_2_builtin_style); out.writeByte(field_3_outline_style_level); } else { out.writeShort(field_4_name.length()); out.writeByte(field_3_stringHasMultibyte ? 0x01 : 0x00); if (field_3_stringHasMultibyte) { StringUtil.putUnicodeLE(getName(), out); } else { StringUtil.putCompressedUnicode(getName(), out); } } }
Example 2
Source File: ExtendedPivotTableViewFieldsRecord.java From lams with GNU General Public License v2.0 | 6 votes |
@Override protected void serialize(LittleEndianOutput out) { out.writeInt(_grbit1); out.writeByte(_grbit2); out.writeByte(_citmShow); out.writeShort(_isxdiSort); out.writeShort(_isxdiShow); if (_subtotalName == null) { out.writeShort(STRING_NOT_PRESENT_LEN); } else { out.writeShort(_subtotalName.length()); } out.writeInt(_reserved1); out.writeInt(_reserved2); if (_subtotalName != null) { StringUtil.putUnicodeLE(_subtotalName, out); } }
Example 3
Source File: NoteRecord.java From lams with GNU General Public License v2.0 | 6 votes |
public void serialize(LittleEndianOutput out) { out.writeShort(field_1_row); out.writeShort(field_2_col); out.writeShort(field_3_flags); out.writeShort(field_4_shapeid); out.writeShort(field_6_author.length()); out.writeByte(field_5_hasMultibyte ? 0x01 : 0x00); if (field_5_hasMultibyte) { StringUtil.putUnicodeLE(field_6_author, out); } else { StringUtil.putCompressedUnicode(field_6_author, out); } if (field_7_padding != null) { out.writeByte(field_7_padding.intValue()); } }
Example 4
Source File: FontRecord.java From lams with GNU General Public License v2.0 | 6 votes |
public void serialize(LittleEndianOutput out) { out.writeShort(getFontHeight()); out.writeShort(getAttributes()); out.writeShort(getColorPaletteIndex()); out.writeShort(getBoldWeight()); out.writeShort(getSuperSubScript()); out.writeByte(getUnderline()); out.writeByte(getFamily()); out.writeByte(getCharset()); out.writeByte(field_9_zero); int fontNameLen = field_11_font_name.length(); out.writeByte(fontNameLen); boolean hasMultibyte = StringUtil.hasMultibyte(field_11_font_name); out.writeByte(hasMultibyte ? 0x01 : 0x00); if (fontNameLen > 0) { if (hasMultibyte) { StringUtil.putUnicodeLE(field_11_font_name, out); } else { StringUtil.putCompressedUnicode(field_11_font_name, out); } } }
Example 5
Source File: NameCommentRecord.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public void serialize(final LittleEndianOutput out) { final int field_4_name_length = field_6_name_text.length(); final int field_5_comment_length = field_7_comment_text.length(); out.writeShort(field_1_record_type); out.writeShort(field_2_frt_cell_ref_flag); out.writeLong(field_3_reserved); out.writeShort(field_4_name_length); out.writeShort(field_5_comment_length); boolean isNameMultiByte = StringUtil.hasMultibyte(field_6_name_text); out.writeByte(isNameMultiByte ? 1 : 0); if (isNameMultiByte) { StringUtil.putUnicodeLE(field_6_name_text, out); } else { StringUtil.putCompressedUnicode(field_6_name_text, out); } boolean isCommentMultiByte = StringUtil.hasMultibyte(field_7_comment_text); out.writeByte(isCommentMultiByte ? 1 : 0); if (isCommentMultiByte) { StringUtil.putUnicodeLE(field_7_comment_text, out); } else { StringUtil.putCompressedUnicode(field_7_comment_text, out); } }
Example 6
Source File: UnicodeString.java From lams with GNU General Public License v2.0 | 6 votes |
protected void serialize(ContinuableRecordOutput out) { int dataSize = getDataSize(); out.writeContinueIfRequired(8); out.writeShort(reserved); out.writeShort(dataSize); out.writeShort(formattingFontIndex); out.writeShort(formattingOptions); out.writeContinueIfRequired(6); out.writeShort(numberOfRuns); out.writeShort(phoneticText.length()); out.writeShort(phoneticText.length()); out.writeContinueIfRequired(phoneticText.length()*2); StringUtil.putUnicodeLE(phoneticText, out); for(int i=0; i<phRuns.length; i++) { phRuns[i].serialize(out); } out.write(extraData); }
Example 7
Source File: StringPtg.java From lams with GNU General Public License v2.0 | 5 votes |
public void write(LittleEndianOutput out) { out.writeByte(sid + getPtgClass()); out.writeByte(field_3_string.length()); // Note - nChars is 8-bit out.writeByte(_is16bitUnicode ? 0x01 : 0x00); if (_is16bitUnicode) { StringUtil.putUnicodeLE(field_3_string, out); } else { StringUtil.putCompressedUnicode(field_3_string, out); } }
Example 8
Source File: TableStylesRecord.java From lams with GNU General Public License v2.0 | 5 votes |
@Override protected void serialize(LittleEndianOutput out) { out.writeShort(rt); out.writeShort(grbitFrt); out.write(unused); out.writeInt(cts); out.writeShort(rgchDefListStyle.length()); out.writeShort(rgchDefPivotStyle.length()); StringUtil.putUnicodeLE(rgchDefListStyle, out); StringUtil.putUnicodeLE(rgchDefPivotStyle, out); }
Example 9
Source File: SeriesTextRecord.java From lams with GNU General Public License v2.0 | 5 votes |
public void serialize(LittleEndianOutput out) { out.writeShort(field_1_id); out.writeByte(field_4_text.length()); if (is16bit) { // Excel (2007) seems to choose 16bit regardless of whether it is needed out.writeByte(0x01); StringUtil.putUnicodeLE(field_4_text, out); } else { // Excel can read this OK out.writeByte(0x00); StringUtil.putCompressedUnicode(field_4_text, out); } }
Example 10
Source File: WriteAccessRecord.java From lams with GNU General Public License v2.0 | 5 votes |
public void serialize(LittleEndianOutput out) { String username = getUsername(); boolean is16bit = StringUtil.hasMultibyte(username); out.writeShort(username.length()); out.writeByte(is16bit ? 0x01 : 0x00); if (is16bit) { StringUtil.putUnicodeLE(username, out); } else { StringUtil.putCompressedUnicode(username, out); } int encodedByteCount = 3 + username.length() * (is16bit ? 2 : 1); int paddingSize = DATA_SIZE - encodedByteCount; out.write(PADDING, 0, paddingSize); }
Example 11
Source File: HeaderFooterBase.java From lams with GNU General Public License v2.0 | 5 votes |
public final void serialize(LittleEndianOutput out) { if (getTextLength() > 0) { out.writeShort(getTextLength()); out.writeByte(field_2_hasMultibyte ? 0x01 : 0x00); if (field_2_hasMultibyte) { StringUtil.putUnicodeLE(field_3_text, out); } else { StringUtil.putCompressedUnicode(field_3_text, out); } } }
Example 12
Source File: FormatRecord.java From lams with GNU General Public License v2.0 | 5 votes |
public void serialize(LittleEndianOutput out) { String formatString = getFormatString(); out.writeShort(getIndexCode()); out.writeShort(formatString.length()); out.writeByte(field_3_hasMultibyte ? 0x01 : 0x00); if ( field_3_hasMultibyte ) { StringUtil.putUnicodeLE( formatString, out); } else { StringUtil.putCompressedUnicode( formatString, out); } }
Example 13
Source File: BoundSheetRecord.java From lams with GNU General Public License v2.0 | 5 votes |
public void serialize(LittleEndianOutput out) { out.writeInt(getPositionOfBof()); out.writeShort(field_2_option_flags); String name = field_5_sheetname; out.writeByte(name.length()); out.writeByte(field_4_isMultibyteUnicode); if (isMultibyte()) { StringUtil.putUnicodeLE(name, out); } else { StringUtil.putCompressedUnicode(name, out); } }
Example 14
Source File: HyperlinkRecord.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void serialize(LittleEndianOutput out) { _range.serialize(out); _guid.serialize(out); out.writeInt(0x00000002); // TODO const out.writeInt(_linkOpts); if ((_linkOpts & HLINK_LABEL) != 0){ out.writeInt(_label.length()); StringUtil.putUnicodeLE(_label, out); } if ((_linkOpts & HLINK_TARGET_FRAME) != 0){ out.writeInt(_targetFrame.length()); StringUtil.putUnicodeLE(_targetFrame, out); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0) { out.writeInt(_address.length()); StringUtil.putUnicodeLE(_address, out); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0) { _moniker.serialize(out); if(URL_MONIKER.equals(_moniker)){ if (_uninterpretedTail == null) { out.writeInt(_address.length()*2); StringUtil.putUnicodeLE(_address, out); } else { out.writeInt(_address.length()*2 + TAIL_SIZE); StringUtil.putUnicodeLE(_address, out); writeTail(_uninterpretedTail, out); } } else if (FILE_MONIKER.equals(_moniker)){ out.writeShort(_fileOpts); out.writeInt(_shortFilename.length()); StringUtil.putCompressedUnicode(_shortFilename, out); writeTail(_uninterpretedTail, out); if (_address == null) { out.writeInt(0); } else { int addrLen = _address.length() * 2; out.writeInt(addrLen + 6); out.writeInt(addrLen); out.writeShort(0x0003); // TODO const StringUtil.putUnicodeLE(_address, out); } } } if((_linkOpts & HLINK_PLACE) != 0){ out.writeInt(_textMark.length()); StringUtil.putUnicodeLE(_textMark, out); } }
Example 15
Source File: EmbeddedObjectRefSubRecord.java From lams with GNU General Public License v2.0 | 4 votes |
public void serialize(LittleEndianOutput out) { int formulaSize = field_2_refPtg == null ? field_2_unknownFormulaData.length : field_2_refPtg.getSize(); int idOffset = getStreamIDOffset(formulaSize); int dataSize = getDataSize(idOffset); out.writeShort(sid); out.writeShort(dataSize); out.writeShort(idOffset); out.writeShort(formulaSize); out.writeInt(field_1_unknown_int); int pos = 12; if (field_2_refPtg == null) { out.write(field_2_unknownFormulaData); } else { field_2_refPtg.write(out); } pos += formulaSize; int stringLen; if (field_4_ole_classname == null) { // don't write 0x03, stringLen, flag, text stringLen = 0; } else { out.writeByte(0x03); pos+=1; stringLen = field_4_ole_classname.length(); out.writeShort(stringLen); pos+=2; if (stringLen > 0) { out.writeByte(field_3_unicode_flag ? 0x01 : 0x00); pos+=1; if (field_3_unicode_flag) { StringUtil.putUnicodeLE(field_4_ole_classname, out); pos += stringLen * 2; } else { StringUtil.putCompressedUnicode(field_4_ole_classname, out); pos += stringLen; } } } // pad to next 2-byte boundary (requires 0 or 1 bytes) switch(idOffset - (pos - 6)) { // 6 for 3 shorts: sid, dataSize, idOffset case 1: out.writeByte(field_4_unknownByte == null ? 0x00 : field_4_unknownByte.intValue()); pos++; break; case 0: break; default: throw new IllegalStateException("Bad padding calculation (" + idOffset + ", " + pos + ")"); } if (field_5_stream_id != null) { out.writeInt(field_5_stream_id.intValue()); pos += 4; } out.write(field_6_unknown); }