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 2004/02/06 22:49:28 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fonts/truetype FontFileReader.java TTFDirTabEntry.java
jeremias 2004/02/06 13:49:28
Modified: src/java/org/apache/fop/pdf TempFileStreamCache.java
PDFFactory.java
src/java/org/apache/fop/fonts/type1 PFMFile.java
PFBParser.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfExternalGraphic.java
src/java/org/apache/fop/fonts/truetype FontFileReader.java
TTFDirTabEntry.java
Log:
Adapt to changes in Commons IO's APIs.
Revision Changes Path
1.4 +3 -3 xml-fop/src/java/org/apache/fop/pdf/TempFileStreamCache.java
Index: TempFileStreamCache.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/TempFileStreamCache.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TempFileStreamCache.java 4 Jul 2003 20:12:59 -0000 1.3
+++ TempFileStreamCache.java 6 Feb 2004 21:49:28 -0000 1.4
@@ -4,7 +4,7 @@
* The Apache Software License, Version 1.1
* ============================================================================
*
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 1999-2004 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -57,7 +57,7 @@
import java.io.File;
//Commons
-import org.apache.commons.io.IOUtil;
+import org.apache.commons.io.CopyUtils;
/**
* StreamCache implementation that uses temporary files rather than heap.
@@ -124,7 +124,7 @@
// don't need a buffer because streamCopy is buffered
InputStream input = new java.io.FileInputStream(tempFile);
- final long bytesCopied = IOUtil.copy(input, out);
+ final long bytesCopied = CopyUtils.copy(input, out);
input.close();
return (int)bytesCopied;
}
1.7 +3 -3 xml-fop/src/java/org/apache/fop/pdf/PDFFactory.java
Index: PDFFactory.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PDFFactory.java 30 Aug 2003 18:52:35 -0000 1.6
+++ PDFFactory.java 6 Feb 2004 21:49:28 -0000 1.7
@@ -4,7 +4,7 @@
* The Apache Software License, Version 1.1
* ============================================================================
*
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 1999-2004 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -59,7 +59,7 @@
// Apache libs
import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.commons.io.IOUtil;
+import org.apache.commons.io.IOUtils;
// FOP
import org.apache.fop.fonts.CIDFont;
@@ -1180,7 +1180,7 @@
embeddedFont = new PDFT1Stream();
((PDFT1Stream)embeddedFont).setData(pfb);
} else {
- byte[] file = IOUtil.toByteArray(in);
+ byte[] file = IOUtils.toByteArray(in);
embeddedFont = new PDFTTFStream(file.length);
((PDFTTFStream)embeddedFont).setData(file, file.length);
}
1.4 +3 -3 xml-fop/src/java/org/apache/fop/fonts/type1/PFMFile.java
Index: PFMFile.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/type1/PFMFile.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PFMFile.java 19 Aug 2003 00:53:54 -0000 1.3
+++ PFMFile.java 6 Feb 2004 21:49:28 -0000 1.4
@@ -4,7 +4,7 @@
* The Apache Software License, Version 1.1
* ============================================================================
*
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 1999-2004 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -57,7 +57,7 @@
// Apache libs
import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.commons.io.IOUtil;
+import org.apache.commons.io.IOUtils;
// FOP
import org.apache.fop.fonts.Glyphs;
@@ -101,7 +101,7 @@
* @throws IOException In case of an I/O problem
*/
public void load(InputStream inStream) throws IOException {
- final byte[] buf = IOUtil.toByteArray(inStream);
+ final byte[] buf = IOUtils.toByteArray(inStream);
final InputStream bufin = new java.io.ByteArrayInputStream(buf);
PFMInputStream in = new PFMInputStream(bufin);
/*final int version =*/ in.readShort();
1.3 +3 -3 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PFBParser.java 8 May 2003 17:17:17 -0000 1.2
+++ PFBParser.java 6 Feb 2004 21:49:28 -0000 1.3
@@ -4,7 +4,7 @@
* The Apache Software License, Version 1.1
* ============================================================================
*
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 1999-2004 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -56,7 +56,7 @@
import java.io.BufferedInputStream;
//Commons
-import org.apache.commons.io.IOUtil;
+import org.apache.commons.io.IOUtils;
/**
* This class represents a parser for Adobe Type 1 PFB files.
@@ -261,7 +261,7 @@
private void parseRAWFormat(PFBData pfb, BufferedInputStream bin)
throws IOException {
- calcLengths(pfb, IOUtil.toByteArray(bin));
+ calcLengths(pfb, IOUtils.toByteArray(bin));
}
}
1.5 +5 -5 xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java
Index: RtfExternalGraphic.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RtfExternalGraphic.java 22 Nov 2003 17:40:13 -0000 1.4
+++ RtfExternalGraphic.java 6 Feb 2004 21:49:28 -0000 1.5
@@ -4,7 +4,7 @@
* The Apache Software License, Version 1.1
* ============================================================================
*
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 1999-2004 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -58,7 +58,7 @@
package org.apache.fop.render.rtf.rtflib.rtfdoc;
-import org.apache.commons.io.IOUtil;
+import org.apache.commons.io.IOUtils;
import org.apache.fop.render.rtf.rtflib.tools.ImageConstants;
import org.apache.fop.render.rtf.rtflib.tools.ImageUtil;
//import org.apache.fop.render.rtf.rtflib.tools.jpeg.Encoder;
@@ -248,9 +248,9 @@
try {
final InputStream in = url.openStream();
try {
- imagedata = IOUtil.toByteArray(url.openStream());
+ imagedata = IOUtils.toByteArray(url.openStream());
} finally {
- IOUtil.shutdownStream(in);
+ IOUtils.closeQuietly(in);
}
} catch (Exception e) {
throw new ExternalGraphicException("The attribute 'src' of "
1.3 +5 -11 xml-fop/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
Index: FontFileReader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/truetype/FontFileReader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FontFileReader.java 27 May 2003 14:05:49 -0000 1.2
+++ FontFileReader.java 6 Feb 2004 21:49:28 -0000 1.3
@@ -4,7 +4,7 @@
* The Apache Software License, Version 1.1
* ============================================================================
*
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 1999-2004 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -54,7 +54,7 @@
import java.io.File;
import java.io.IOException;
-import org.apache.commons.io.IOUtil;
+import org.apache.commons.io.IOUtils;
/**
* Reads a TrueType font file into a byte array and
@@ -73,15 +73,9 @@
* @throws IOException In case of an I/O problem
*/
private void init(InputStream in) throws java.io.IOException {
- java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
- try {
- IOUtil.copy(in, bout);
- this.file = bout.toByteArray();
- this.fsize = this.file.length;
- this.current = 0;
- } finally {
- bout.close();
- }
+ this.file = IOUtils.toByteArray(in);
+ this.fsize = this.file.length;
+ this.current = 0;
}
/**
1.2 +17 -2 xml-fop/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
Index: TTFDirTabEntry.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TTFDirTabEntry.java 11 Mar 2003 13:05:23 -0000 1.1
+++ TTFDirTabEntry.java 6 Feb 2004 21:49:28 -0000 1.2
@@ -51,6 +51,7 @@
package org.apache.fop.fonts.truetype;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
/**
@@ -76,9 +77,11 @@
offset = in.readTTFULong();
length = in.readTTFULong();
+ String tagStr = new String(tag, "ISO-8859-1");
+ // System.err.println("tag='" + tagStr + "'");
//System.out.println(this.toString());
- return new String(tag, "ISO-8859-1");
+ return tagStr;
}
@@ -115,11 +118,23 @@
}
/**
- * Returns the tag.
+ * Returns the tag bytes.
* @return byte[]
*/
public byte[] getTag() {
return tag;
+ }
+
+ /**
+ * Returns the tag bytes.
+ * @return byte[]
+ */
+ public String getTagString() {
+ try {
+ return new String(tag, "ISO-8859-1");
+ } catch (UnsupportedEncodingException e) {
+ return this.toString(); // Should never happen.
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org