aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2009-02-05 16:27:08 +0000
committerJeremias Maerki <jeremias@apache.org>2009-02-05 16:27:08 +0000
commit4e27a1c9dd7246dff9d9380755171f179e3fcb8a (patch)
tree93817887ac0a99f6a3c1b736cae9ce5688eb4bab /src/java/org/apache/fop/afp/modca/IncludedResourceObject.java
parent7fbf442044c42fce773c36cd9aea80694abf007d (diff)
downloadxmlgraphics-fop-4e27a1c9dd7246dff9d9380755171f179e3fcb8a.tar.gz
xmlgraphics-fop-4e27a1c9dd7246dff9d9380755171f179e3fcb8a.zip
Performance improvements and file-size reductions by introducing letter-spacing and word-spacing attributes in new IF (as mentioned on fop-dev).
Allow to control whether kerning information is loaded from fonts. Started support for AFP font embedding (incomplete and currently disabled) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@741165 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/afp/modca/IncludedResourceObject.java')
-rw-r--r--src/java/org/apache/fop/afp/modca/IncludedResourceObject.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java b/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java
new file mode 100644
index 000000000..296ab2d9d
--- /dev/null
+++ b/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.afp.modca;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+
+import org.apache.commons.io.IOUtils;
+
+import org.apache.fop.afp.util.ResourceAccessor;
+
+
+/**
+ * Encapsulates an included resource object that is loaded from an external file.
+ */
+public class IncludedResourceObject extends AbstractNamedAFPObject {
+
+ private ResourceAccessor resourceAccessor;
+ private URI uri;
+
+ /**
+ * Main constructor.
+ * @param name the name of the included resource
+ * @param resourceAccessor the resource accessor to load the external file with
+ * @param uri the URI of the external file
+ */
+ public IncludedResourceObject(String name,
+ ResourceAccessor resourceAccessor, URI uri) {
+ super(name);
+ this.resourceAccessor = resourceAccessor;
+ this.uri = uri;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ InputStream in = resourceAccessor.createInputStream(this.uri);
+ try {
+ IOUtils.copy(in, os);
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+ }
+
+}