You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ac...@apache.org on 2003/02/22 16:06:18 UTC

cvs commit: jakarta-poi/src/scratchpad/src/org/apache/poi/hdf/extractor WordDocument.java

acoliver    2003/02/22 07:06:18

  Modified:    src/scratchpad/src/org/apache/poi/hdf/extractor
                        WordDocument.java
  Log:
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14735
  
  Revision  Changes    Path
  1.6       +15 -14    jakarta-poi/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
  
  Index: WordDocument.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WordDocument.java	24 Sep 2002 03:10:19 -0000	1.5
  +++ WordDocument.java	22 Feb 2003 15:06:18 -0000	1.6
  @@ -196,19 +196,17 @@
         if(unicode)
         {
           add = 2;
  -      }
  -      char ch;
  -      for(int y = start; y < end; y += add)
  -      {
  -        if(unicode)
  -        {
  -          ch = (char)Utils.convertBytesToShort(_header, y);
  -        }
  -        else
  +        char ch;
  +        for(int y = start; y < end; y += add)
           {
  -          ch = (char)_header[y];
  +	  ch = (char)Utils.convertBytesToShort(_header, y);
  +	  out.write(ch);
           }
  -        out.write(ch);
  +      }
  +      else
  +      {
  +	String sText = new String(_header, start, end-start);
  +	out.write(sText);
         }
       }
     }
  @@ -221,10 +219,13 @@
      */
     public WordDocument(String fileName) throws IOException
     {
  -
  -
  +  	this(new FileInputStream(fileName));
  +  }
  +  
  +  public WordDocument(InputStream inputStream) throws IOException
  +  {
           //do Ole stuff
  -        istream = new FileInputStream(fileName);
  +        istream = inputStream;
           filesystem = new POIFSFileSystem(istream);
   
           //get important stuff from the Header block and parse all the