You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by de...@apache.org on 2001/07/05 18:54:53 UTC

cvs commit: xml-batik/sources/org/apache/batik/util Base64EncoderStream.java Base64DecodeStream.java Base64Decoder.java Base64Encoder.java CharacterDecoder.java CharacterEncoder.java

deweese     01/07/05 09:54:52

  Modified:    test-resources/org/apache/batik/test regard.xml
               sources/org/apache/batik/ext/awt RenderingHintsKeyExt.java
               sources/org/apache/batik/ext/awt/image/rendered
                        AbstractTiledRed.java Any2LumRed.java
               sources/org/apache/batik/svggen
                        ImageHandlerBase64Encoder.java
               sources/org/apache/batik/util Base64DecodeStream.java
  Added:       test-references/org/apache/batik/util fourByte fourByte.64
                        large medium medium.64 medium.pc.64 oneByte
                        oneByte.64 small small.64 tenByte tenByte.64
                        threeByte threeByte.64 twoByte twoByte.64 zeroByte
                        zeroByte.64
               test-resources/org/apache/batik/util regBase64.xml
                        regParsedURL.xml
               test-resources/org/apache/batik/util/resources
                        TestMessages.properties
               test-sources/org/apache/batik/util Base64Test.java
                        Messages.java ParsedURLTest.java
               sources/org/apache/batik/util Base64EncoderStream.java
  Removed:     sources/org/apache/batik/util Base64Decoder.java
                        Base64Encoder.java CharacterDecoder.java
                        CharacterEncoder.java
  Log:
  1) Fixed a bug in the Base64DecoderStream.
  2) Re-implemented Base64 Encoding as a Stream (round tripping now works).
  3) Added test cases for Base64 Encoding/Decoding
  4) Added test cases for ParsedURL parsing.
  5) Removed old Base64Encoder/Decoder and base classes.
  
  Revision  Changes    Path
  1.1                  xml-batik/test-references/org/apache/batik/util/fourByte
  
  Index: fourByte
  ===================================================================
  ABCD
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/fourByte.64
  
  Index: fourByte.64
  ===================================================================
  QUJDRA==
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/large
  
  	<<Binary file>>
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/medium
  
  	<<Binary file>>
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/medium.64
  
  Index: medium.64
  ===================================================================
  H4sICFfuQDsAA21lZGl1bQCtVk1T4zgQvedXdOUyUGUCzO5c2I9ax1FAVcbOWjYstzG2Qlxj
  WynZIZV/v6/lhG/2skMVRLFbr9973S1Bf/zEnxG9/0lXmvx1XuBDmWW/za2msCp022mPbrTt
  KtPS+eR8RD+XyYgCs97Z6mHV01FwTF/Pzs4+JDM3m7bMe9CYkF/X5LZ0ZHWn7aMuJwyV6LLq
  elvdbziO8rakTaepaqkzG1to9+S+anO7o6WxTefRtupXZKz7NJueGlNWy6rIT0bEGB5x7rW2
  TdX3uqS1NY9ViUW/ynv80cCpa7Ot2gcqTFtWvKlzmxrdXzCp88kbXh2ZJR0YFaZE6KbrCVL6
  HFQZNL83j/zu4Ay1pkcxPFe5flV1VAOQcV4mbcs3jJC1qPOq0dbZ8/U9E+R74cdAxGqoLDcg
  9xGV/8uE9hJLU2wa3faupA4Nu05RCYO3lpq817bK6+7Zclcqt/WFBCfsl4lrGd2WJ6i3fY2N
  hEW9eQVgX7ngUbVE8p3n5Dsq+y30RgXlxY/WbGtdPjD8BdE4ZQsGv/rDto6rO7StQyv1o67N
  Ggzofucg/6O7iY5Wfb++OD3dbreT3MVNjH04PZ6MHZpfw5kW9tRg7Crwhha82+HZeq3zJ7cP
  fKjqO10vPUhcHkynLQwHRUvdpmCDKluerHPb794Adyi+bfK63u3Rnfm/Dua3eQPh4ylE/Bg7
  WBp/rnJMQ6+hm+gefqBsaBnjKKGMxmJseSzhbGN6rPcWdzDTVo9s5RKv9vqf1B2mGOGVsQ5t
  a3ly22GGu86dH3Me+HfPPVrXOu+42dE6xdAJQwH+eq6D0/xtQosDoSdGz4Se+HAlWCJrLGAc
  ovamjD02kwNcmsPTQ9n2daus8xXlOihzwj4gTzyC2DG0yOdnJ7NPr6QiFc/TWz8RhPUiiW/k
  TMzo+3df4cGXL+RHM/zekfhnkQil8C5OSF4vQokl9iV+lEqhcA7IKAizmYwuPZpmKUVxSqG8
  lini0thDMvHBPorndC2S4Apf/akMZXrHKUc0l2mEfERz5PNp4SepDLLQT4gWWbKIlSAmTTOp
  gtCX12I2IVBAWiJxI6KU1JUfhsR5R+Qv/AD5n7QCNYtmfirjiJygVFEQR2kiQT1OkHYqwN6f
  hsIRcBbMZCKC1CndL1kz/AL10CO1EIHkBbwSEOondx5jA1eJvzNE4S0I+9f+JYQfOb9wvXxu
  GcoRZIm4ZjVslMqmKpVplgq6jOOZYnQlkhsZCPUbhbFSIw7LlPCQJvVdekaBmQjAl2mm5GCr
  jFKRJNmCLTgmuopv4RrI+hnXmKseRyMnmx2MkztGZkdcjSDy9krgReJMd9b5bAgpeBikryKR
  F56mo71k1ksUictQXoooEI5kzFi3UoljlFUqDgGuy3/rIzfcQX7uIZaH9Zvu9VzRSc7Jn91I
  16ZDODpFyX1jOQuDq30JhhF4NaY88R1uBHczP5p6g/nHlcjnwPNV2eR8IeAAb3BXYD7LCtfS
  BjfUiHj87vUqr5eHMXw3gq/+f+HzpzH8tGr53h0OftMOA/z59D6dUJ3W9PvH18Sfk9G/1zkl
  kS0KAAA=
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/medium.pc.64
  
  Index: medium.pc.64
  ===================================================================
  H4sICFfuQDsAA21lZGl1bQCtVk1T4zgQvedXdOUyUGUCzO5c2I9ax1FAVcbOWjYstzG2Qlxj
  WynZIZV/v6/lhG/2skMVRLFbr9973S1Bf/zEnxG9/0lXmvx1XuBDmWW/za2msCp022mPbrTt
  KtPS+eR8RD+XyYgCs97Z6mHV01FwTF/Pzs4+JDM3m7bMe9CYkF/X5LZ0ZHWn7aMuJwyV6LLq
  elvdbziO8rakTaepaqkzG1to9+S+anO7o6WxTefRtupXZKz7NJueGlNWy6rIT0bEGB5x7rW2
  TdX3uqS1NY9ViUW/ynv80cCpa7Ot2gcqTFtWvKlzmxrdXzCp88kbXh2ZJR0YFaZE6KbrCVL6
  HFQZNL83j/zu4Ay1pkcxPFe5flV1VAOQcV4mbcs3jJC1qPOq0dbZ8/U9E+R74cdAxGqoLDcg
  9xGV/8uE9hJLU2wa3faupA4Nu05RCYO3lpq817bK6+7Zclcqt/WFBCfsl4lrGd2WJ6i3fY2N
  hEW9eQVgX7ngUbVE8p3n5Dsq+y30RgXlxY/WbGtdPjD8BdE4ZQsGv/rDto6rO7StQyv1o67N
  Ggzofucg/6O7iY5Wfb++OD3dbreT3MVNjH04PZ6MHZpfw5kW9tRg7Crwhha82+HZeq3zJ7cP
  fKjqO10vPUhcHkynLQwHRUvdpmCDKluerHPb794Adyi+bfK63u3Rnfm/Dua3eQPh4ylE/Bg7
  WBp/rnJMQ6+hm+gefqBsaBnjKKGMxmJseSzhbGN6rPcWdzDTVo9s5RKv9vqf1B2mGOGVsQ5t
  a3ly22GGu86dH3Me+HfPPVrXOu+42dE6xdAJQwH+eq6D0/xtQosDoSdGz4Se+HAlWCJrLGAc
  ovamjD02kwNcmsPTQ9n2daus8xXlOihzwj4gTzyC2DG0yOdnJ7NPr6QiFc/TWz8RhPUiiW/k
  TMzo+3df4cGXL+RHM/zekfhnkQil8C5OSF4vQokl9iV+lEqhcA7IKAizmYwuPZpmKUVxSqG8
  lini0thDMvHBPorndC2S4Apf/akMZXrHKUc0l2mEfERz5PNp4SepDLLQT4gWWbKIlSAmTTOp
  gtCX12I2IVBAWiJxI6KU1JUfhsR5R+Qv/AD5n7QCNYtmfirjiJygVFEQR2kiQT1OkHYqwN6f
  hsIRcBbMZCKC1CndL1kz/AL10CO1EIHkBbwSEOondx5jA1eJvzNE4S0I+9f+JYQfOb9wvXxu
  GcoRZIm4ZjVslMqmKpVplgq6jOOZYnQlkhsZCPUbhbFSIw7LlPCQJvVdekaBmQjAl2mm5GCr
  jFKRJNmCLTgmuopv4RrI+hnXmKseRyMnmx2MkztGZkdcjSDy9krgReJMd9b5bAgpeBikryKR
  F56mo71k1ksUictQXoooEI5kzFi3UoljlFUqDgGuy3/rIzfcQX7uIZaH9Zvu9VzRSc7Jn91I
  16ZDODpFyX1jOQuDq30JhhF4NaY88R1uBHczP5p6g/nHlcjnwPNV2eR8IeAAb3BXYD7LCtfS
  BjfUiHj87vUqr5eHMXw3gq/+f+HzpzH8tGr53h0OftMOA/z59D6dUJ3W9PvH18Sfk9G/1zkl
  kS0KAAA=
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/oneByte
  
  Index: oneByte
  ===================================================================
  A
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/oneByte.64
  
  Index: oneByte.64
  ===================================================================
  QQ==
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/small
  
  Index: small
  ===================================================================
  							Thomas DeWeese
  Thomas.DeWeese@Kodak.com
  			  "The only difference between theory and practice is
  			   that in theory there isn't any." -- unknown
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/small.64
  
  Index: small.64
  ===================================================================
  CQkJCQkJCVRob21hcyBEZVdlZXNlClRob21hcy5EZVdlZXNlQEtvZGFrLmNvbQoJCQkgICJU
  aGUgb25seSBkaWZmZXJlbmNlIGJldHdlZW4gdGhlb3J5IGFuZCBwcmFjdGljZSBpcwoJCQkg
  ICB0aGF0IGluIHRoZW9yeSB0aGVyZSBpc24ndCBhbnkuIiAtLSB1bmtub3duCg==
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/tenByte
  
  Index: tenByte
  ===================================================================
  JIHGFEDCBA
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/tenByte.64
  
  Index: tenByte.64
  ===================================================================
  SklIR0ZFRENCQQ==
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/threeByte
  
  Index: threeByte
  ===================================================================
  ABC
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/threeByte.64
  
  Index: threeByte.64
  ===================================================================
  QUJD
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/twoByte
  
  Index: twoByte
  ===================================================================
  AB
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/twoByte.64
  
  Index: twoByte.64
  ===================================================================
  QUI=
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/zeroByte
  
  	<<Binary file>>
  
  
  1.1                  xml-batik/test-references/org/apache/batik/util/zeroByte.64
  
  	<<Binary file>>
  
  
  1.5       +3 -1      xml-batik/test-resources/org/apache/batik/test/regard.xml
  
  Index: regard.xml
  ===================================================================
  RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/regard.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- regard.xml	2001/05/19 01:24:10	1.4
  +++ regard.xml	2001/07/05 16:54:31	1.5
  @@ -11,7 +11,7 @@
   <!-- regression testing.                                                       -->
   <!--                                                                           -->
   <!-- @author vincent.hardy@eng.sun.com                                         -->
  -<!-- @version $Id: regard.xml,v 1.4 2001/05/19 01:24:10 vhardy Exp $  -->
  +<!-- @version $Id: regard.xml,v 1.5 2001/07/05 16:54:31 deweese Exp $  -->
   <!-- ========================================================================= -->
   <testRun name="Batik Standard Regression Test Run">
       <testRun name="REGARD">
  @@ -28,6 +28,8 @@
               </arg>
           </testReportProcessor>
   
  +        <testSuite href="file:test-resources/org/apache/batik/util/regParsedURL.xml" />
  +        <testSuite href="file:test-resources/org/apache/batik/util/regBase64.xml" />
           <testSuite href="file:test-resources/org/apache/batik/test/samplesRendering.xml" />
           <testSuite href="file:test-resources/org/apache/batik/svggen/regsvggen.xml" />
           <testSuite href="file:test-resources/org/apache/batik/test/unitTesting.xml" />
  
  
  
  1.1                  xml-batik/test-resources/org/apache/batik/util/regBase64.xml
  
  Index: regBase64.xml
  ===================================================================
  <!-- ====================================================================== -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.     -->
  <!--                                                                        -->
  <!-- This software is published under the terms of the Apache Software      -->
  <!-- License version 1.1, a copy of which has been included with this       -->
  <!-- distribution in the LICENSE file.                                      -->
  <!-- ====================================================================== -->
  
  <!-- ====================================================================== -->
  <!-- @author deweese@apache.org                                             -->
  <!-- @version $Id: regBase64.xml,v 1.1 2001/07/05 16:54:33 deweese Exp $     -->
  <!-- ====================================================================== -->
  
  <testSuite name="Base64 test Suite">
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="ENCODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium.pc.64" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.lang.String" value="DECODE" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium.pc.64" />
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
      </test>
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
      </test>
  
      <test class="org.apache.batik.util.Base64Test">
          <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/large" />
      </test>
  
  </testSuite>
  
  
  
  1.1                  xml-batik/test-resources/org/apache/batik/util/regParsedURL.xml
  
  Index: regParsedURL.xml
  ===================================================================
  <!-- ====================================================================== -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.     -->
  <!--                                                                        -->
  <!-- This software is published under the terms of the Apache Software      -->
  <!-- License version 1.1, a copy of which has been included with this       -->
  <!-- distribution in the LICENSE file.                                      -->
  <!-- ====================================================================== -->
  
  <!-- ====================================================================== -->
  <!-- @author deweese@apache.org                                             -->
  <!-- @version $Id: regParsedURL.xml,v 1.1 2001/07/05 16:54:33 deweese Exp $     -->
  <!-- ====================================================================== -->
  
  <testSuite name="Parsed URL test Suite">
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" value="xml.apache.org" />
          <arg class="java.lang.String" value="//xml.apache.org" />
      </test>
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" value="http://xml.apache.org/" />
          <arg class="java.lang.String" value="~deweese" />
          <arg class="java.lang.String" value="http://xml.apache.org/~deweese" />
      </test>
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" value="file:///xml.apache.org" />
          <arg class="java.lang.String" value="~deweese" />
          <arg class="java.lang.String" value="file:/~deweese" />
      </test>
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" value="fooz:/home/deweese/.cshrc" />
          <arg class="java.lang.String" value="fooz:/home/deweese/.cshrc" />
      </test>
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" value="fooz:///home/deweese/.cshrc" />
          <arg class="java.lang.String" value="fooz:/home/deweese/.cshrc" />
      </test>
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" 
               value="fooz://www.com:1234/home/deweese/.cshrc#abcd" />
          <arg class="java.lang.String" 
               value="fooz://www.com:1234/home/deweese/.cshrc#abcd" />
      </test>
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" 
               value="fooz://www.com:1234/home/deweese/.cshrc#abcd" />
          <arg class="java.lang.String" 
               value="xyz.html#efgh" />
          <arg class="java.lang.String" 
               value="fooz://www.com:1234/home/deweese/xyz.html#efgh" />
      </test>
      <test class="org.apache.batik.util.ParsedURLTest">
          <arg class="java.lang.String" 
               value="fooz://www.com:1234/home/deweese/xyz.html#efgh" />
          <arg class="java.lang.String" 
               value="/xyz.svg#ijkl" />
          <arg class="java.lang.String" 
               value="fooz://www.com:1234/xyz.svg#ijkl" />
      </test>
  </testSuite>
  
  
  
  1.1                  xml-batik/test-resources/org/apache/batik/util/resources/TestMessages.properties
  
  Index: TestMessages.properties
  ===================================================================
  #############################################################################
  # Copyright (C) The Apache Software Foundation. All rights reserved.        #
  #############################################################################
  # This software is published under the terms of the Apache Software License #
  # version 1.1, a copy of which has been included with this distribution in  #
  # the LICENSE file.                                                         #
  #############################################################################
  
  #
  # Error Message values for ParsedURL Tests
  #
  ParsedURLTest.error.cannot.parse.url = \
  Error while Parsing URL: \
  Base URL {0} \
  Sub  URL {1} \
  Got stack trace {2}
  
  ParsedURLTest.error.wrong.result = \
  Expected Result : {1} \
       Got Result : {0}
  
  #
  # Error Message values for Base64 Tests
  #
  Base64Test.error.bad.action.string = \
  Error bad action string for test: \
  Action string: {0}
  
  Base64Test.error.cannot.read.in.url = \
  Error while trying to read source URL: \
   Source URL: {0} \
  Stack trace: {1}
  
  Base64Test.error.cannot.read.ref.url = \
  Error while trying to read reference URL: \
  Reference URL: {0} \
    Stack trace: {1}
  
  Base64Test.error.wrong.result = \
  Computed answer differed from reference at byte {0}
  
  #
  # Entry Keys
  # 
  ParsedURLTest.entry.key.error.description = \
  Error Description.
  
  Base64Test.entry.key.error.description = \
  Error Description.
  
  
  
  
  1.1                  xml-batik/test-sources/org/apache/batik/util/Base64Test.java
  
  Index: Base64Test.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.util;
  
  import org.apache.batik.test.AbstractTest;
  import org.apache.batik.test.DefaultTestReport;
  import org.apache.batik.test.TestReport;
  
  import java.io.PipedOutputStream;
  import java.io.PipedInputStream;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.io.IOException;
  import java.io.StringWriter;
  import java.io.PrintWriter;
  
  import java.net.URL;
  
  /**
   * This test validates that the ParsedURL class properly parses and
   * cascades URLs.
   *
   * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
   * @version $Id: Base64Test.java,v 1.1 2001/07/05 16:54:35 deweese Exp $
   */
  public class Base64Test extends AbstractTest {
      /**
       * Error when bad action string given.
       * {0} = Bad action string
       */
      public static final String ERROR_BAD_ACTION_STRING
          = "Base64Test.error.bad.action.string";
  
      /**
       * Error when unable to read/open in URL
       * {0} = URL
       * {1} = exception stack trace.
       */
      public static final String ERROR_CANNOT_READ_IN_URL
          = "Base64Test.error.cannot.read.in.url";
  
      /**
       * Error when unable to read/open ref URL
       * {0} = URL
       * {1} = exception stack trace.
       */
      public static final String ERROR_CANNOT_READ_REF_URL
          = "Base64Test.error.cannot.read.ref.url";
  
      /**
       * Result didn't match reference result.
       * {0} = first byte of mismatch
       */
      public static final String ERROR_WRONG_RESULT
          = "Base64Test.error.wrong.result";
  
      public static final String ENTRY_KEY_ERROR_DESCRIPTION
          = "Base64Test.entry.key.error.description";
  
      protected String action = null;
      protected URL    in     = null;
      protected URL    ref    = null;
  
      /**
       * Constructor. ref is ignored if action == ROUND.
       * @param action The action to perform, one of:
       *               ROUND  : base64 encode then base64 decode.
       *               ENCODE : encode in to base 64 and compare result to ref.
       *               DECODE : decode in (must be base 64) and compare to ref.
       * @param in     The source file to apply 'action' to.
       * @param ref    The reference file.
       */
      public Base64Test(String action, URL in, URL ref) {
          this.action = action;
          this.in     = in;
          this.ref    = ref;
      }
  
      /**
       * Constructor, for round trip testing (only one file required).
       * @param in     The source file to round trip.
       */
      public Base64Test(URL in) {
          this.action = "ROUND";
          this.in     = in;
      }
  
      /**
       * Returns this Test's name
       */
      public String getName() {
          return action + " -- " + in + " -- " + super.getName();
      }
  
      /**
       * This method will only throw exceptions if some aspect
       * of the test's internal operation fails.
       */
      public TestReport runImpl() throws Exception {
          DefaultTestReport report
              = new DefaultTestReport(this);
  
          InputStream inIS;
  
          try {
              inIS = in.openStream();
          } catch(Exception e) {
              StringWriter trace = new StringWriter();
              e.printStackTrace(new PrintWriter(trace));
              report.setErrorCode(ERROR_CANNOT_READ_IN_URL);
              report.setDescription(new TestReport.Entry[] {
                  new TestReport.Entry
                      (Messages.formatMessage(ENTRY_KEY_ERROR_DESCRIPTION, null),
                       Messages.formatMessage
                       (ERROR_CANNOT_READ_IN_URL,
                        new String[]{in.toString(), trace.toString()}))
                      });
              report.setPassed(false);
              return report;
          }
  
          if (action.equals("ROUND"))
              this.ref = in;
          else if (!action.equals("ENCODE") && 
                   !action.equals("DECODE")) {
              report.setErrorCode(ERROR_BAD_ACTION_STRING);
              report.setDescription(new TestReport.Entry[] {
                  new TestReport.Entry
                      (Messages.formatMessage(ENTRY_KEY_ERROR_DESCRIPTION, null),
                       Messages.formatMessage(ERROR_BAD_ACTION_STRING, 
                                              new String[]{action}))
                      });
              report.setPassed(false);
              return report;
          }
  
          InputStream refIS;
          try {
              refIS = ref.openStream();
          } catch(Exception e) {
              StringWriter trace = new StringWriter();
              e.printStackTrace(new PrintWriter(trace));
              report.setErrorCode(ERROR_CANNOT_READ_REF_URL);
              report.setDescription(new TestReport.Entry[] {
                  new TestReport.Entry
                      (Messages.formatMessage(ENTRY_KEY_ERROR_DESCRIPTION, null),
                       Messages.formatMessage
                       (ERROR_CANNOT_READ_REF_URL,
                        new String[]{ref.toString(), trace.toString()}))
                      });
              report.setPassed(false);
              return report;
          }
  
          if (action.equals("ENCODE") ||
              action.equals("ROUND")) {
            // We need to encode the incomming data
            PipedOutputStream pos = new PipedOutputStream();
            OutputStream os = new Base64EncoderStream(pos);
  
            // Copy the input to the Base64 Encoder (in a seperate thread).
            Thread t = new StreamCopier(inIS, os);
            
            // Read that from the piped output stream.
            inIS = new PipedInputStream(pos);
            t.start();
          }
  
          if (action.equals("DECODE")||
              action.equals("ROUND")) {
              inIS = new Base64DecodeStream(inIS);
          } 
  
  
          int mismatch = compareStreams(inIS, refIS, action.equals("ENCODE"));
          
          if (mismatch == -1) {
            report.setPassed(true);
            return report;
          }
  
          report.setErrorCode(ERROR_WRONG_RESULT);
          report.setDescription(new TestReport.Entry[] {
            new TestReport.Entry
              (Messages.formatMessage(ENTRY_KEY_ERROR_DESCRIPTION, null),
               Messages.formatMessage(ERROR_WRONG_RESULT, 
                                      new String[]{""+mismatch}))
              });
          report.setPassed(false);
          return report;
      }
  
      /**
       * Returns true if the contents of <tt>is1</tt> match the
       * contents of <tt>is2</tt>
       */
      static int compareStreams(InputStream is1, InputStream is2, 
                                boolean skipws) {
          byte [] data1 = new byte[100];
          byte [] data2 = new byte[100];
          int off1=0;
          int off2=0;
  
          boolean match = true;
          int idx=0;
          try {
              while(true) {
                  int len1 = is1.read(data1, off1, data1.length-off1);
                  int len2 = is2.read(data2, off2, data2.length-off2);
  
                  if (off1 != 0) {
                      if (len1 == -1)
                          len1 = off1;
                      else
                          len1 += off1;
                  }
  
                  if (off2 != 0) {
                      if (len2 == -1)
                          len2 = off2;
                      else
                          len2 += off2;
                  }
  
                  if (len1 == -1) {
                      if (len2 == -1)
                          break; // Both done...
  
                      // Only is1 is done...
                      if (!skipws)
                          return idx;
  
                      // check if the rest of is2 is whitespace...
                      for (int i2=0; i2<len2; i2++)
                          if ((data2[i2] != '\n') &&
                              (data2[i2] != '\r') && 
                              (data2[i2] != ' '))
                              return idx+i2;
                      off1 = off2 = 0;
                      continue;
                  }
  
                  if (len2 == -1) {
                      // Only is2 is done...
                      if (!skipws)
                          return idx;
  
                      // Check if rest of is1 is whitespace...
                      for (int i1=0; i1<len1; i1++)
                          if ((data1[i1] != '\n') &&
                              (data1[i1] != '\r') && 
                              (data1[i1] != ' '))
                              return idx+i1;
                      off1 = off2 = 0;
                      continue;
                  }
  
                  int i1=0;
                  int i2=0;
                  while((i1<len1) && (i2<len2)) {
                      if (skipws) {
                          if ((data1[i1] == '\n') || 
                              (data1[i1] == '\r') || 
                              (data1[i1] == ' ')) {
                              i1++;
                              continue;
                          }
                          if ((data2[i2] == '\n') || 
                              (data2[i2] == '\r') || 
                              (data2[i2] == ' ')) {
                              i2++;
                              continue;
                          }
                      }
                      if (data1[i1] != data2[i2])
                          return idx+i2;
  
                      i1++;
                      i2++;
                  }
  
                  if (i1 != len1)
                      System.arraycopy(data1, i1, data1, 0, len1-i1);
                  if (i2 != len2)
                      System.arraycopy(data2, i2, data2, 0, len2-i2);
                  off1 = len1-i1;
                  off2 = len2-i2;
                  idx+=i2;
              }
          } catch(IOException ioe) {
              ioe.printStackTrace();
              return idx;
          }
  
          return -1;
      }
  
  
      static class StreamCopier extends Thread {
          InputStream src;
          OutputStream dst;
  
          public StreamCopier(InputStream src,
                              OutputStream dst) {
              this.src = src;
              this.dst = dst;
          }
  
          public void run() {
              try {
                  byte [] data = new byte[1000];
                  while(true) {
                      int len = src.read(data, 0, data.length);
                      if (len == -1) break;
  
                      dst.write(data, 0, len);
                  }
              } catch (IOException ioe) {
                  // Nothing
              }
              try {
                  dst.close();
              } catch (IOException ioe) {
                  // Nothing
              }
          }
      }
  }
  
  
  
  1.1                  xml-batik/test-sources/org/apache/batik/util/Messages.java
  
  Index: Messages.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.util;
  
  import java.util.Locale;
  import java.util.MissingResourceException;
  import org.apache.batik.i18n.Localizable;
  import org.apache.batik.i18n.LocalizableSupport;
  
  /**
   * This class manages the message for the test.svg module.
   *
   * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
   * @version $Id: Messages.java,v 1.1 2001/07/05 16:54:36 deweese Exp $
   */
  public class Messages {
  
      /**
       * This class does not need to be instantiated.
       */
      protected Messages() { }
  
      /**
       * The error messages bundle class name.
       */
      protected final static String RESOURCES =
          "org.apache.batik.util.resources.TestMessages";
  
      /**
       * The localizable support for the error messages.
       */
      protected static LocalizableSupport localizableSupport =
          new LocalizableSupport(RESOURCES);
  
      /**
       * Implements {@link org.apache.batik.i18n.Localizable#setLocale(Locale)}.
       */
      public static void setLocale(Locale l) {
          localizableSupport.setLocale(l);
      }
  
      /**
       * Implements {@link org.apache.batik.i18n.Localizable#getLocale()}.
       */
      public static Locale getLocale() {
          return localizableSupport.getLocale();
      }
  
      /**
       * Implements {@link
       * org.apache.batik.i18n.Localizable#formatMessage(String,Object[])}.
       */
      public static String formatMessage(String key, Object[] args)
          throws MissingResourceException {
          return localizableSupport.formatMessage(key, args);
      }
  }
  
  
  
  1.1                  xml-batik/test-sources/org/apache/batik/util/ParsedURLTest.java
  
  Index: ParsedURLTest.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.util;
  
  import org.apache.batik.test.AbstractTest;
  import org.apache.batik.test.DefaultTestReport;
  import org.apache.batik.test.TestReport;
  
  import java.io.StringWriter;
  import java.io.PrintWriter;
  
  /**
   * This test validates that the ParsedURL class properly parses and
   * cascades URLs.
   *
   * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
   * @version $Id: ParsedURLTest.java,v 1.1 2001/07/05 16:54:36 deweese Exp $
   */
  public class ParsedURLTest extends AbstractTest {
      /**
       * Error when unable to parse URL
       * {0} = 'Base URL' or NULL
       * {1} = Sub URL
       * {2} = exception stack trace.
       */
      public static final String ERROR_CANNOT_PARSE_URL
          = "ParsedURLTest.error.cannot.parse.url";
  
      /**
       * Result didn't match expected result.
       * {0} = result
       * {1} = expected result
       */
      public static final String ERROR_WRONG_RESULT
          = "ParsedURLTest.error.wrong.result";
  
      public static final String ENTRY_KEY_ERROR_DESCRIPTION
          = "ParsedURLTest.entry.key.error.description";
  
      protected String base = null;
      protected String sub  = null;
      protected String ref  = null;
      /**
       * Constructor
       * @param url The url to parse
       * @param ref The expected result.
       */
      public ParsedURLTest(String url, String ref ){
          this.base = url;
          this.ref  = ref;
      }
  
      /**
       * Constructor
       * @param base The base url to parse
       * @param sub The sub url (relative to base).
       * @param ref The expected result.
       */
      public ParsedURLTest(String base, String sub, String ref){
          this.base = base;
          this.sub  = sub;
          this.ref  = ref;
      }
  
      /**
       * Returns this Test's name
       */
      public String getName() {
          return ref + " -- " + super.getName();
      }
  
      /**
       * This method will only throw exceptions if some aspect
       * of the test's internal operation fails.
       */
      public TestReport runImpl() throws Exception {
          DefaultTestReport report
              = new DefaultTestReport(this);
  
          ParsedURL url;
          try {
              url = new ParsedURL(base);
              if (sub != null) {
                  url  = new ParsedURL(url, sub);
              }
          } catch(Exception e) {
              StringWriter trace = new StringWriter();
              e.printStackTrace(new PrintWriter(trace));
              report.setErrorCode(ERROR_CANNOT_PARSE_URL);
              report.setDescription(new TestReport.Entry[] {
                  new TestReport.Entry
                      (Messages.formatMessage(ENTRY_KEY_ERROR_DESCRIPTION, null),
                       Messages.formatMessage
                       (ERROR_CANNOT_PARSE_URL,
                        new String[]{sub == null? "null" : base, 
                                     sub,
                                     trace.toString()}))
                      });
              report.setPassed(false);
              return report;
          }
  
          if (ref.equals(url.toString())) {
              report.setPassed(true);
              return report;
          }
  
          report.setErrorCode(ERROR_WRONG_RESULT);
          report.setDescription(new TestReport.Entry[] {
            new TestReport.Entry
              (Messages.formatMessage(ENTRY_KEY_ERROR_DESCRIPTION, null),
               Messages.formatMessage
               (ERROR_WRONG_RESULT, new String[]{url.toString(), ref }))
              });
          report.setPassed(false);
          return report;
      }
  }
  
  
  
  1.3       +11 -1     xml-batik/sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java
  
  Index: RenderingHintsKeyExt.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RenderingHintsKeyExt.java	2001/02/03 16:26:06	1.2
  +++ RenderingHintsKeyExt.java	2001/07/05 16:54:37	1.3
  @@ -15,7 +15,7 @@
    * KEY_AREA_OF_INTEREST
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: RenderingHintsKeyExt.java,v 1.2 2001/02/03 16:26:06 deweese Exp $
  + * @version $Id: RenderingHintsKeyExt.java,v 1.3 2001/07/05 16:54:37 deweese Exp $
    */
   public final class RenderingHintsKeyExt {
       /**
  @@ -25,6 +25,16 @@
       public static final RenderingHints.Key KEY_AREA_OF_INTEREST =
           new AreaOfInterestHintKey();
   
  +    /**
  +     * Hint for the destination of the rendering when it is a BufferedImage
  +     * This works around the fact that Java 2D sometimes lies about the
  +     * attributes of the Graphics2D device, when it is an image.
  +     *
  +     * It is strongly suggested that you use
  +     * org.apache.batik.ext.awt.image.GraphicsUtil.createGraphics to
  +     * create a Graphics2D from a BufferedImage, this will ensure that
  +     * the proper things are done in the processes of creating the
  +     * Graphics.  */
       public static final RenderingHints.Key KEY_BUFFERED_IMAGE =
           new BufferedImageHintKey();
   
  
  
  
  1.9       +4 -1      xml-batik/sources/org/apache/batik/ext/awt/image/rendered/AbstractTiledRed.java
  
  Index: AbstractTiledRed.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/rendered/AbstractTiledRed.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractTiledRed.java	2001/04/19 17:31:17	1.8
  +++ AbstractTiledRed.java	2001/07/05 16:54:39	1.9
  @@ -28,7 +28,7 @@
    * the subclass implementation.
    *
    * @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
  - * @version $Id: AbstractTiledRed.java,v 1.8 2001/04/19 17:31:17 deweese Exp $
  + * @version $Id: AbstractTiledRed.java,v 1.9 2001/07/05 16:54:39 deweese Exp $
    */
   public abstract class AbstractTiledRed 
       extends    AbstractRed
  @@ -534,6 +534,9 @@
   
           if ((tx1 < tx0) || (ty1 < ty0))
               return;
  +
  +        // System.out.println("WR: " + wrR);
  +        // System.out.println("ME: " + bounds);
   
           int insideTx0 = tx0;
           int insideTx1 = tx1;
  
  
  
  1.2       +2 -3      xml-batik/sources/org/apache/batik/ext/awt/image/rendered/Any2LumRed.java
  
  Index: Any2LumRed.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/rendered/Any2LumRed.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Any2LumRed.java	2001/01/24 05:39:38	1.1
  +++ Any2LumRed.java	2001/07/05 16:54:42	1.2
  @@ -36,7 +36,7 @@
    * new image.
    *
    * @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
  - * @version $Id: Any2LumRed.java,v 1.1 2001/01/24 05:39:38 vhardy Exp $ */
  + * @version $Id: Any2LumRed.java,v 1.2 2001/07/05 16:54:42 deweese Exp $ */
   public class Any2LumRed extends AbstractRed {
   
       /**
  @@ -56,7 +56,6 @@
                     FilterAsAlphaRable.VALUE_COLORSPACE_GREY);
       }
   
  -
       public WritableRaster copyData(WritableRaster wr) {
           // Get my source.
           CachableRed src = (CachableRed)getSources().get(0);
  @@ -105,7 +104,7 @@
               } else {
                   // All this nonsense is to work around the fact that the
                   // Color convert op doesn't properly copy the Alpha from
  -                // s    rc to dst.
  +                // src to dst.
                   PixelInterleavedSampleModel dstSM;
                   dstSM = (PixelInterleavedSampleModel)wr.getSampleModel();
                   SampleModel smna = new PixelInterleavedSampleModel
  
  
  
  1.13      +12 -15    xml-batik/sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
  
  Index: ImageHandlerBase64Encoder.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ImageHandlerBase64Encoder.java	2001/07/04 16:50:01	1.12
  +++ ImageHandlerBase64Encoder.java	2001/07/05 16:54:44	1.13
  @@ -15,7 +15,7 @@
   import java.io.*;
   import java.net.*;
   
  -import org.apache.batik.util.Base64Encoder;
  +import org.apache.batik.util.Base64EncoderStream;
   import org.apache.batik.ext.awt.image.codec.ImageEncoder;
   import org.apache.batik.ext.awt.image.codec.PNGImageEncoder;
   
  @@ -28,7 +28,7 @@
    * the data protocol.
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: ImageHandlerBase64Encoder.java,v 1.12 2001/07/04 16:50:01 cjolif Exp $
  + * @version $Id: ImageHandlerBase64Encoder.java,v 1.13 2001/07/05 16:54:44 deweese Exp $
    * @see             org.apache.batik.svggen.SVGGraphics2D
    * @see             org.apache.batik.svggen.ImageHandler
    */
  @@ -111,20 +111,20 @@
       protected void handleHREF(RenderedImage image, Element imageElement,
                                 SVGGeneratorContext generatorContext)
           throws SVGGraphics2DIOException {
  -        //
  -        // First, encode the input image in PNG
  -        //
  -        byte[] pngBytes = encodeImage(image);
   
           //
  -        // Now, convert PNG data to Base64
  +        // Setup Base64Encoder stream to byte array.
           //
  -        Base64Encoder b64Encoder = new Base64Encoder();
  -        ByteArrayInputStream is = new ByteArrayInputStream(pngBytes);
           ByteArrayOutputStream os = new ByteArrayOutputStream();
  +        Base64EncoderStream b64Encoder = new Base64EncoderStream(os);
           try {
  -            b64Encoder.encodeBuffer(new ByteArrayInputStream(pngBytes),
  -                                    os);
  +            //
  +            // Now, encode the input image to the base 64 stream.
  +            //
  +            encodeImage(image, b64Encoder);
  +
  +            // Close the b64 encoder stream (terminates the b64 streams).
  +            b64Encoder.close();
           } catch (IOException e) {
               // Should not happen because we are doing in-memory processing
               throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e);
  @@ -140,14 +140,11 @@
   
       }
   
  -    public byte[] encodeImage(RenderedImage buf)
  +    public void encodeImage(RenderedImage buf, OutputStream os)
           throws SVGGraphics2DIOException {
           try{
  -            ByteArrayOutputStream os = new ByteArrayOutputStream();
               ImageEncoder encoder = new PNGImageEncoder(os, null);
               encoder.encode(buf);
  -            os.close();
  -            return os.toByteArray();
           } catch(IOException e) {
               // We are doing in-memory processing. This should not happen.
               throw new SVGGraphics2DIOException(ERR_UNEXPECTED);
  
  
  
  1.2       +86 -93    xml-batik/sources/org/apache/batik/util/Base64DecodeStream.java
  
  Index: Base64DecodeStream.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/Base64DecodeStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Base64DecodeStream.java	2001/04/10 14:48:49	1.1
  +++ Base64DecodeStream.java	2001/07/05 16:54:47	1.2
  @@ -36,7 +36,7 @@
    * @author <a href="thomas.deweese@kodak.com">Thomas DeWeese</a>
    * @author <a href="vincent.hardy@eng.sun.com">Vincent Hardy</a>
    * @author      Chuck McManis
  - * @version $Id: Base64DecodeStream.java,v 1.1 2001/04/10 14:48:49 deweese Exp $
  + * @version $Id: Base64DecodeStream.java,v 1.2 2001/07/05 16:54:47 deweese Exp $
    */
   
   public class Base64DecodeStream extends InputStream {
  @@ -49,127 +49,120 @@
   
       private final static byte pem_array[] = new byte[256];
       static {
  -	int idx = 0;
  -	for (int i=0; i<pem_array.length; i++)
  -	    pem_array[i] = -1;
  -
  -	for (char c='A'; c<='Z'; c++) {
  -	    pem_array[c] = (byte)idx++;
  -	}
  -	for (char c='a'; c<='z'; c++) {
  -	    pem_array[c] = (byte)idx++;
  -	}
  +        for (int i=0; i<pem_array.length; i++)
  +            pem_array[i] = -1;
  +
  +        int idx = 0;
  +        for (char c='A'; c<='Z'; c++) {
  +            pem_array[c] = (byte)idx++;
  +        }
  +        for (char c='a'; c<='z'; c++) {
  +            pem_array[c] = (byte)idx++;
  +        }
   	
  -	for (char c='0'; c<='9'; c++) {
  -	    pem_array[c] = (byte)idx++;
  -	}
  +        for (char c='0'; c<='9'; c++) {
  +            pem_array[c] = (byte)idx++;
  +        }
   
  -	pem_array['+'] = (byte)idx++;
  -	pem_array['/'] = (byte)idx++;
  +        pem_array['+'] = (byte)idx++;
  +        pem_array['/'] = (byte)idx++;
       }
   
       public boolean markSupported() { return false; }
   
       public void close() 
  -	throws IOException {
  -	EOF = true;
  +        throws IOException {
  +        EOF = true;
       }
   
       public int available() 
  -	throws IOException {
  -	return 3-out_offset;
  +        throws IOException {
  +        return 3-out_offset;
       }
   
       byte decode_buffer[] = new byte[4];
       byte out_buffer[] = new byte[3];
       int  out_offset = 3;
  -    int  line_offset = 0;
       boolean EOF = false;
   
       public int read() throws IOException {
  -
  -	if (EOF) return -1;
   
  -	if (out_offset == 3) {
  -	    if (getNextAtom()) {
  -		EOF = true;
  -		return -1;
  -	    }
  -	}
  +        if (out_offset == 3) {
  +            if (EOF || getNextAtom()) {
  +                EOF = true;
  +                return -1;
  +            }
  +        }
   
  -	return out_buffer[out_offset++];
  +        return out_buffer[out_offset++];
       }
   
       public int read(byte []out, int offset, int len) 
  -	throws IOException {
  +        throws IOException {
  +
  +        int idx = 0;
  +        while (idx < len) {
  +            if (out_offset == 3) {
  +                if (EOF || getNextAtom()) {
  +                    EOF = true;
  +                    if (idx == 0) return -1;
  +                    else          return idx;
  +                }
  +            }
   
  -	if (EOF) return -1;
  +            out[offset+idx] = out_buffer[out_offset++];
   
  -	int idx = 0;
  -	while (idx < len) {
  -	    if (out_offset == 3) {
  -		if (getNextAtom()) {
  -		    EOF = true;
  -		    if (idx == 0) return -1;
  -		    else          return idx;
  -		}
  -	    }
  -
  -	    out[offset+idx] = out_buffer[out_offset++];
  -
  -	    idx++;
  -	}
  -	return idx;
  +            idx++;
  +        }
  +        return idx;
       }
   
       final boolean getNextAtom() throws IOException {
  -	int count, a, b, c, d;
  -	if (line_offset == 64) {
  -	    // End of current line so setup next one.
  -	    if (decodeLineSuffix()) 
  -		return true;
  -	    line_offset = 0;
  -	}
  -
  -	decode_buffer[0] = (byte) src.read();
  -	if (decode_buffer[0] == -1)
  -	    return true;
  -
  -	// check to see if we caught the trailing end of a <CR><LF>
  -	if (decode_buffer[0] == '\n') 
  -	    count = src.read(decode_buffer, 0, 4);
  -	else
  -	    count = src.read(decode_buffer, 1, 3);
  -	
  -	if (count == -1)
  -	    return true;
  -	line_offset+=4;
  -
  -	a = pem_array[decode_buffer[0]];
  -	b = pem_array[decode_buffer[1]];
  -	c = pem_array[decode_buffer[2]];
  -	d = pem_array[decode_buffer[3]];
  -	
  -	out_buffer[0] = (byte)((a<<2) | (b>>>4));
  -	out_buffer[1] = (byte)((b<<4) | (c>>>2));
  -	out_buffer[2] = (byte)((c<<6) |  d     );
  -	out_offset = 0;
  -	return false;
  -    }
  -
  -    /**
  -     * decodeLineSuffix in this decoder simply finds the [newLine] and
  -     * positions us past it.
  -     */
  -    boolean decodeLineSuffix() throws IOException{
  -        int c;
  -
  -        while (true) {
  -            c = src.read();
  -            if (c == -1) return true;
  -            if ((c == '\n') || (c == '\r') || (c == ' ')) {
  -                return false;
  +        int count, a, b, c, d;
  +
  +        int off = 0;
  +        while(off != 4) {
  +            count = src.read(decode_buffer, off, 4-off);
  +            if (count == -1)
  +                return true;
  +
  +            int in=off, out=off;
  +            while(in < off+count) {
  +                if ((decode_buffer[in] != '\n') && 
  +                    (decode_buffer[in] != '\r') &&
  +                    (decode_buffer[in] != ' '))
  +                    decode_buffer[out++] = decode_buffer[in];
  +                in++;
               }
  +
  +            off = out;
  +        }
  +
  +        a = pem_array[((int)decode_buffer[0])&0xFF];
  +        b = pem_array[((int)decode_buffer[1])&0xFF];
  +        c = pem_array[((int)decode_buffer[2])&0xFF];
  +        d = pem_array[((int)decode_buffer[3])&0xFF];
  +	
  +        out_buffer[0] = (byte)((a<<2) | (b>>>4));
  +        out_buffer[1] = (byte)((b<<4) | (c>>>2));
  +        out_buffer[2] = (byte)((c<<6) |  d     );
  +
  +        if (decode_buffer[3] != '=') {
  +            // All three bytes are good.
  +            out_offset=0;
  +        } else if (decode_buffer[2] == '=') {
  +            // Only one byte of output.
  +            out_buffer[2] = out_buffer[0];
  +            out_offset = 2;
  +            EOF=true;
  +        } else {
  +            // Only two bytes of output.
  +            out_buffer[2] = out_buffer[1];
  +            out_buffer[1] = out_buffer[0];
  +            out_offset = 1;
  +            EOF=true;
           }
  +            
  +        return false;
       }
   }
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/util/Base64EncoderStream.java
  
  Index: Base64EncoderStream.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.util;
  
  import java.io.OutputStream;
  import java.io.PrintStream;
  import java.io.IOException;
  
  /**
   * This class implements a Base64 Character encoder as specified in RFC1113.
   * Unlike some other encoding schemes there is nothing in this encoding
   * that indicates where a buffer starts or ends.
   *
   * This means that the encoded text will simply start with the first line
   * of encoded text and end with the last line of encoded text.
   *
   * @author <a href="deweese@apache.org">Thomas DeWeese</a>
   * @author <a href="vincent.hardy@eng.sun.com">Vincent Hardy</a>
   * @author      Chuck McManis
   * @version $Id: Base64EncoderStream.java,v 1.1 2001/07/05 16:54:49 deweese Exp $
   * @see         Base64DecoderStream
   */
  
  public class Base64EncoderStream extends OutputStream {
  
      /** This array maps the 6 bit values to their characters */
      private final static byte pem_array[] = {
      //   0   1   2   3   4   5   6   7
          'A','B','C','D','E','F','G','H', // 0
          'I','J','K','L','M','N','O','P', // 1
          'Q','R','S','T','U','V','W','X', // 2
          'Y','Z','a','b','c','d','e','f', // 3
          'g','h','i','j','k','l','m','n', // 4
          'o','p','q','r','s','t','u','v', // 5
          'w','x','y','z','0','1','2','3', // 6
          '4','5','6','7','8','9','+','/'  // 7
      };
  
      byte [] atom = new byte[3];
      int     atomLen = 0;
      byte [] encodeBuf = new byte[4];
      int     lineLen = 0;
  
      PrintStream  out;
      boolean closeOutOnClose;
  
      public Base64EncoderStream(OutputStream out) {
          this.out = new PrintStream(out);
          closeOutOnClose = true;
      }
  
      public Base64EncoderStream(OutputStream out, boolean closeOutOnClose) {
          this.out = new PrintStream(out);
          this.closeOutOnClose = closeOutOnClose;
      }
  
      public void close () throws IOException {
          if (out != null) {
              encodeAtom();
              out.flush();        
              if (closeOutOnClose)
                  out.close();
              out=null;
          }
      }
  
      /**
       * This can't really flush out output since that may generate
       * '=' chars which would indicate the end of the stream.
       * Instead we flush out.  You can only be sure all output is 
       * writen by closing this stream.
       */
      public void flush() throws IOException {
          out.flush();
      }
  
      public void write(int b) throws IOException {
          atom[atomLen++] = (byte)b;
          if (atomLen == 3)
              encodeAtom();
      }
  
      public void write(byte []data) throws IOException {
          encodeFromArray(data, 0, data.length);
      }
  
      public void write(byte [] data, int off, int len) throws IOException {
          encodeFromArray(data, off, len);
      }
  
      /**
       * enocodeAtom - Take three bytes of input and encode it as 4
       * printable characters. Note that if the length in len is less
       * than three is encodes either one or two '=' signs to indicate
       * padding characters.
       */
      void encodeAtom() throws IOException {
          byte a, b, c;
  
          switch (atomLen) {
          case 0: return;
          case 1:
              a = atom[0];
              encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)];
              encodeBuf[1] = pem_array[((a <<  4) & 0x30)];
              encodeBuf[2] = encodeBuf[3] = '=';
              break;
          case 2:
              a = atom[0];
              b = atom[1];
              encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)];
              encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))];
              encodeBuf[2] = pem_array[((b  << 2) & 0x3C)];
              encodeBuf[3] = '=';
              break;
          default:
              a = atom[0];
              b = atom[1];
              c = atom[2];
              encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)];
              encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))];
              encodeBuf[2] = pem_array[(((b << 2) & 0x3C) | ((c >>> 6) & 0x03))];
              encodeBuf[3] = pem_array[c & 0x3F];
          }
          if (lineLen == 64) {
              out.println();
              lineLen = 0;
          }
          out.write(encodeBuf);
  
          lineLen += 4;
          atomLen = 0;
      }
  
      /**
       * enocodeAtom - Take three bytes of input and encode it as 4
       * printable characters. Note that if the length in len is less
       * than three is encodes either one or two '=' signs to indicate
       * padding characters.
       */
      void encodeFromArray(byte[] data, int offset, int len) 
          throws IOException{
          byte a, b, c;
          if (len == 0)
              return;
  
          // System.out.println("atomLen: " + atomLen + 
          //                    " len: " + len + 
          //                    " offset:  " + offset);
  
          if (atomLen != 0) {
              switch(atomLen) {
              case 1:
                  atom[1] = data[offset++]; len--; atomLen++;
                  if (len == 0) return;
                  atom[2] = data[offset++]; len--; atomLen++;
                  break;
              case 2:
                  atom[2] = data[offset++]; len--; atomLen++;
                  break;
              default:
              }
              encodeAtom();
          }
  
          while (len >=3) {
              a = data[offset++];
              b = data[offset++];
              c = data[offset++];
              
              encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)];
              encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))];
              encodeBuf[2] = pem_array[(((b << 2) & 0x3C) | ((c >>> 6) & 0x03))];
              encodeBuf[3] = pem_array[c & 0x3F];
              out.write(encodeBuf);
  
              lineLen += 4;
              if (lineLen == 64) {
                  out.println();
                  lineLen = 0;
              }
  
              len -=3;
          }
  
          switch (len) {
          case 1:
              atom[0] = data[offset];
              break;
          case 2:
              atom[0] = data[offset];
              atom[1] = data[offset+1];
              break;
          default:
          }
          atomLen = len;
      }
  
      
      
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org