]> source.dussan.org Git - poi.git/commitdiff
fixed a problem with unicode and text
authorSaid Ryan Ackley <sackley@apache.org>
Thu, 13 Nov 2003 13:44:26 +0000 (13:44 +0000)
committerSaid Ryan Ackley <sackley@apache.org>
Thu, 13 Nov 2003 13:44:26 +0000 (13:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353450 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java

index 23308b5421d63701e04d4be4838c6e2fa6d222e5..c9a417f980403dd769882dc58ff84c387aaf6d27 100644 (file)
@@ -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());