~ubuntu-branches/ubuntu/karmic/batik/karmic

« back to all changes in this revision

Viewing changes to pdf-transcoder/src/java/org/apache/fop/render/afp/modca/Overlay.java

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev, Onkar Shinde, Matvey Kozhev
  • Date: 2008-07-19 01:03:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080719010305-0b24skqy185kdsb9
Tags: 1.7.dfsg-0ubuntu1
[ Onkar Shinde ]
* New upstream version (LP: #147818)
* debian/control
  - Add Sun JDK 1.5 as build dependency. Fixes FTBFS on buildd. (LP: #150484)
    Also add Sun JRE as runtime dependencies.
  - Add ant-optional as build dependency.
  - Add libxml-commons-external-java and libxmlgraphics-commons-java as
    build and runtime dependencies.
  - Add 'Homepage' field and correct the url.
  - Change standards version to 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
* debian/rules
  - Change JAVA_HOME_DIRS for Sun JDK.
  - Add jar file names to DEB_JARS to match new build requirements.
  - Extract version from changelog.
  - Delete bundled jar files in clean target.
  - Don't use hardcoded version in install target.
  - Add get-orig-source target.
* debian/README.Debian-source
  - Change the fo tag name to the one used for this version.
* debian/watch
  - Change expression to match src distribution.
* debian/patches/
  - 01_build_xml.patch, 02_fix_jar_target.patch - Refresh for current source.
  - 03_fix_lib_dirs.patch - Fix the library and classpath references needed
    for pdf transcoder build.
  - 04_fix_transcoder_pkg.patch - Fix transcoder-pkg target to not copy
    files from other jar files.

[ Matvey Kozhev ]
* debian/changelog:
  - Added ".dfsg" to version.
* debian/control, debian/rules:
  - Build with openjdk-6-jdk, depend on openjdk-6-jre.
  - Added java-6-sun as an alternate build JAVA_HOME directory.
  - Fixed get-orig-source to not include debian/ and delete the source dir,
    and made it delete jars from lib/, as done in the current batik package.
* debian/wrappers.sh:
  - Changed java-7-icedtea reference to java-6-openjdk, as the former has been
    removed back in Hardy.
  - Added newline.
* debian/libbatik-java.install:
  - Added newline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
 
3
 * contributor license agreements.  See the NOTICE file distributed with
 
4
 * this work for additional information regarding copyright ownership.
 
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
6
 * (the "License"); you may not use this file except in compliance with
 
7
 * the License.  You may obtain a copy of the License at
 
8
 *
 
9
 *      http://www.apache.org/licenses/LICENSE-2.0
 
10
 *
 
11
 * Unless required by applicable law or agreed to in writing, software
 
12
 * distributed under the License is distributed on an "AS IS" BASIS,
 
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
14
 * See the License for the specific language governing permissions and
 
15
 * limitations under the License.
 
16
 */
 
17
 
 
18
/* $Id: Overlay.java 426576 2006-07-28 15:44:37Z jeremias $ */
 
19
 
 
20
package org.apache.fop.render.afp.modca;
 
21
 
 
22
import java.io.ByteArrayOutputStream;
 
23
import java.io.IOException;
 
24
import java.io.OutputStream;
 
25
import java.util.Iterator;
 
26
 
 
27
/**
 
28
 */
 
29
public class Overlay extends AbstractPageObject{
 
30
 
 
31
    /**
 
32
     * Construct a new overlay object for the specified name argument, the overlay
 
33
     * name should be an 8 character identifier.
 
34
     *
 
35
     * @param name
 
36
     *            the name of the page.
 
37
     * @param width
 
38
     *            the width of the page.
 
39
     * @param height
 
40
     *            the height of the page.
 
41
     * @param rotation
 
42
     *            the rotation of the page.
 
43
     */
 
44
    public Overlay(String name, int width, int height, int rotation) {
 
45
 
 
46
        super(name, width, height, rotation);
 
47
 
 
48
    }
 
49
 
 
50
    /**
 
51
     * Accessor method to write the AFP datastream for the overlay.
 
52
     *
 
53
     * @param os The stream to write to
 
54
     * @throws java.io.IOException
 
55
     */
 
56
    public void writeDataStream(OutputStream os)
 
57
        throws IOException {
 
58
 
 
59
        writeStart(os);
 
60
 
 
61
        _activeEnvironmentGroup.writeDataStream(os);
 
62
 
 
63
        writeObjectList(_segments, os);
 
64
 
 
65
        writeObjectList(_tagLogicalElements, os);
 
66
 
 
67
        writeObjectList(_objects, os);
 
68
 
 
69
        writeEnd(os);
 
70
 
 
71
    }
 
72
 
 
73
    /**
 
74
     * Helper method to write the start of the overlay.
 
75
     * @param os The stream to write to
 
76
     */
 
77
    private void writeStart(OutputStream os)
 
78
        throws IOException {
 
79
 
 
80
        byte[] data = new byte[17];
 
81
 
 
82
        data[0] = 0x5A; // Structured field identifier
 
83
        data[1] = 0x00; // Length byte 1
 
84
        data[2] = 0x10; // Length byte 2
 
85
        data[3] = (byte) 0xD3; // Structured field id byte 1
 
86
        data[4] = (byte) 0xA8; // Structured field id byte 2
 
87
        data[5] = (byte) 0xDF; // Structured field id byte 3
 
88
        data[6] = 0x00; // Flags
 
89
        data[7] = 0x00; // Reserved
 
90
        data[8] = 0x00; // Reserved
 
91
 
 
92
        for (int i = 0; i < _nameBytes.length; i++) {
 
93
 
 
94
            data[9 + i] = _nameBytes[i];
 
95
 
 
96
        }
 
97
 
 
98
        os.write(data);
 
99
 
 
100
    }
 
101
 
 
102
    /**
 
103
     * Helper method to write the end of the overlay.
 
104
     * @param os The stream to write to
 
105
     */
 
106
    private void writeEnd(OutputStream os)
 
107
        throws IOException {
 
108
 
 
109
        byte[] data = new byte[17];
 
110
 
 
111
        data[0] = 0x5A; // Structured field identifier
 
112
        data[1] = 0x00; // Length byte 1
 
113
        data[2] = 0x10; // Length byte 2
 
114
        data[3] = (byte) 0xD3; // Structured field id byte 1
 
115
        data[4] = (byte) 0xA9; // Structured field id byte 2
 
116
        data[5] = (byte) 0xDF; // Structured field id byte 3
 
117
        data[6] = 0x00; // Flags
 
118
        data[7] = 0x00; // Reserved
 
119
        data[8] = 0x00; // Reserved
 
120
 
 
121
        for (int i = 0; i < _nameBytes.length; i++) {
 
122
 
 
123
            data[9 + i] = _nameBytes[i];
 
124
 
 
125
        }
 
126
 
 
127
        os.write(data);
 
128
 
 
129
    }
 
130
 
 
131
}