diff options
author | Jeremias Maerki <jeremias@apache.org> | 2004-02-06 21:49:48 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2004-02-06 21:49:48 +0000 |
commit | d1699f53b71bf38df92430ed019f327156341840 (patch) | |
tree | fe14e92249cdff8897b0aa197182763518d6d407 /src/java/org/apache/fop/fonts | |
parent | e7203e225ba835ba7bd79008d6e36062c335698d (diff) | |
download | xmlgraphics-fop-d1699f53b71bf38df92430ed019f327156341840.tar.gz xmlgraphics-fop-d1699f53b71bf38df92430ed019f327156341840.zip |
Adapt to changes in Commons IO's APIs.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197334 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fonts')
4 files changed, 28 insertions, 19 deletions
diff --git a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java index d141435c6..61c3a0eda 100644 --- a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java +++ b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java @@ -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.InputStream; 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 @@ public class FontFileReader { * @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; } /** diff --git a/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java b/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java index 6907cb27d..1e89b562c 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java @@ -51,6 +51,7 @@ package org.apache.fop.fonts.truetype; import java.io.IOException; +import java.io.UnsupportedEncodingException; /** @@ -76,9 +77,11 @@ class TTFDirTabEntry { 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 @@ class TTFDirTabEntry { } /** - * 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. + } + } + } diff --git a/src/java/org/apache/fop/fonts/type1/PFBParser.java b/src/java/org/apache/fop/fonts/type1/PFBParser.java index e59bc94b2..a1badc402 100644 --- a/src/java/org/apache/fop/fonts/type1/PFBParser.java +++ b/src/java/org/apache/fop/fonts/type1/PFBParser.java @@ -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.DataInputStream; 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 @@ public class PFBParser { private void parseRAWFormat(PFBData pfb, BufferedInputStream bin) throws IOException { - calcLengths(pfb, IOUtil.toByteArray(bin)); + calcLengths(pfb, IOUtils.toByteArray(bin)); } }
\ No newline at end of file diff --git a/src/java/org/apache/fop/fonts/type1/PFMFile.java b/src/java/org/apache/fop/fonts/type1/PFMFile.java index 58a7cceb5..bc74c6cfe 100644 --- a/src/java/org/apache/fop/fonts/type1/PFMFile.java +++ b/src/java/org/apache/fop/fonts/type1/PFMFile.java @@ -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.util.Map; // 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 @@ public class PFMFile extends AbstractLogEnabled { * @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(); |