aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/util/ASCIIHexOutputStream.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-04-04 15:15:23 +0000
committerJeremias Maerki <jeremias@apache.org>2006-04-04 15:15:23 +0000
commitdece1d7361bfe21604222d1dbfdc1b599084a363 (patch)
tree15e90914861c79b74e32f8ae82176e29d9059c90 /src/java/org/apache/fop/util/ASCIIHexOutputStream.java
parent46f47c3095c086d88ff7d652aee40303a9ed9601 (diff)
downloadxmlgraphics-fop-dece1d7361bfe21604222d1dbfdc1b599084a363.tar.gz
xmlgraphics-fop-dece1d7361bfe21604222d1dbfdc1b599084a363.zip
Adding dependency on XML Graphics Commons.
Switching to code in XML Graphics Commons for: - PSGraphics2D - Service discovery - Codecs Removed local classes that have been ported to Commons. xmlgraphics-commons-snapshot.jar is a Trunk snapshot built with JDK 1.4.2 from today. It should work under JDK 1.3.1. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@391332 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/util/ASCIIHexOutputStream.java')
-rw-r--r--src/java/org/apache/fop/util/ASCIIHexOutputStream.java102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/java/org/apache/fop/util/ASCIIHexOutputStream.java b/src/java/org/apache/fop/util/ASCIIHexOutputStream.java
deleted file mode 100644
index d2ac48a3e..000000000
--- a/src/java/org/apache/fop/util/ASCIIHexOutputStream.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed 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.util;
-
-import java.io.OutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-
-/**
- * This class applies a ASCII Hex encoding to the stream.
- *
- * @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
- * @version $Id$
- */
-public class ASCIIHexOutputStream extends FilterOutputStream
- implements Finalizable {
-
- private static final int EOL = 0x0A; //"\n"
- private static final int EOD = 0x3E; //">"
- private static final int ZERO = 0x30; //"0"
- private static final int NINE = 0x39; //"9"
- private static final int A = 0x41; //"A"
- private static final int ADIFF = A - NINE - 1;
-
- private int posinline = 0;
-
-
- /** @see java.io.FilterOutputStream **/
- public ASCIIHexOutputStream(OutputStream out) {
- super(out);
- }
-
-
- /** @see java.io.FilterOutputStream **/
- public void write(int b) throws IOException {
- b &= 0xFF;
-
- int digit1 = ((b & 0xF0) >> 4) + ZERO;
- if (digit1 > NINE) {
- digit1 += ADIFF;
- }
- out.write(digit1);
-
- int digit2 = (b & 0x0F) + ZERO;
- if (digit2 > NINE) {
- digit2 += ADIFF;
- }
- out.write(digit2);
-
- posinline++;
- checkLineWrap();
- }
-
-
- private void checkLineWrap() throws IOException {
- //Maximum line length is 80 characters
- if (posinline >= 40) {
- out.write(EOL);
- posinline = 0;
- }
- }
-
-
- /** @see Finalizable **/
- public void finalizeStream() throws IOException {
- checkLineWrap();
- //Write closing character ">"
- super.write(EOD);
-
- flush();
- if (out instanceof Finalizable) {
- ((Finalizable) out).finalizeStream();
- }
- }
-
-
- /** @see java.io.FilterOutputStream **/
- public void close() throws IOException {
- finalizeStream();
- super.close();
- }
-
-
-}
-
-