You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2003/05/08 19:17:17 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fonts/type1 PFBParser.java

jeremias    2003/05/08 10:17:17

  Modified:    src/java/org/apache/fop/fonts/type1 PFBParser.java
  Log:
  Fixed bug:
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19764
  PFBParser reports "Could not load the whole segment"
  Submitted by: Matthias Germann <ge...@post.ch>
  
  Revision  Changes    Path
  1.2       +6 -15     xml-fop/src/java/org/apache/fop/fonts/type1/PFBParser.java
  
  Index: PFBParser.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/type1/PFBParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PFBParser.java	11 Mar 2003 13:05:36 -0000	1.1
  +++ PFBParser.java	8 May 2003 17:17:17 -0000	1.2
  @@ -55,8 +55,8 @@
   import java.io.DataInputStream;
   import java.io.BufferedInputStream;
   
  -//FOP
  -import org.apache.fop.util.StreamUtilities;
  +//Commons
  +import org.apache.commons.io.IOUtil;
   
   /**
    * This class represents a parser for Adobe Type 1 PFB files.
  @@ -155,10 +155,7 @@
           segmentType = din.readUnsignedByte(); //Read
           int len1 = swapInteger(din.readInt());
           byte[] headerSegment = new byte[len1];
  -        bytesRead = din.read(headerSegment);
  -        if (bytesRead != len1) {
  -            throw new IOException("Could not load the whole segment");
  -        }
  +        din.readFully(headerSegment);
           pfb.setHeaderSegment(headerSegment);
   
           //Read second segment
  @@ -169,10 +166,7 @@
           segmentType = din.readUnsignedByte();
           int len2 = swapInteger(din.readInt());
           byte[] encryptedSegment = new byte[len2];
  -        bytesRead = din.read(encryptedSegment);
  -        if (bytesRead != len2) {
  -            throw new IOException("Could not load the whole segment");
  -        }
  +        din.readFully(encryptedSegment);
           pfb.setEncryptedSegment(encryptedSegment);
   
           //Read third segment
  @@ -183,10 +177,7 @@
           segmentType = din.readUnsignedByte();
           int len3 = swapInteger(din.readInt());
           byte[] trailerSegment = new byte[len3];
  -        bytesRead = din.read(trailerSegment);
  -        if (bytesRead != len3) {
  -            throw new IOException("Could not load the whole segment");
  -        }
  +        din.readFully(trailerSegment);
           pfb.setTrailerSegment(trailerSegment);
   
           //Read EOF indicator
  @@ -270,7 +261,7 @@
   
       private void parseRAWFormat(PFBData pfb, BufferedInputStream bin)
               throws IOException {
  -        calcLengths(pfb, StreamUtilities.toByteArray(bin, 32768));
  +        calcLengths(pfb, IOUtil.toByteArray(bin));
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org