From: Said Ryan Ackley Date: Thu, 13 Nov 2003 13:44:26 +0000 (+0000) Subject: fixed a problem with unicode and text X-Git-Tag: PERF_BEFORE_MERGE~85 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f9b0478fa4126f8aa9404538619672ae0bdbc1aa;p=poi.git fixed a problem with unicode and text git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353450 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java index 23308b5421..c9a417f980 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java @@ -63,8 +63,11 @@ import java.io.IOException; import java.util.List; import java.util.ArrayList; +import org.apache.poi.poifs.common.POIFSConstants; + import org.apache.poi.hwpf.model.io.*; + public class TextPieceTable { ArrayList _textPieces = new ArrayList(); @@ -155,6 +158,16 @@ public class TextPieceTable TextPiece next = (TextPiece)_textPieces.get(x); PieceDescriptor pd = next.getPieceDescriptor(); + int offset = docStream.getOffset(); + int mod = (offset % POIFSConstants.BIG_BLOCK_SIZE); + if (mod != 0) + { + mod = POIFSConstants.BIG_BLOCK_SIZE - mod; + byte[] buf = new byte[mod]; + docStream.write(buf); + } + + // set the text piece position to the current docStream offset. pd.setFilePosition(docStream.getOffset());