jakarta-ecs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-ecs/src/java/org/apache/ecs GenericElement.java
Date Sun, 03 Jun 2001 14:33:03 GMT
rdonkin     01/06/03 07:33:03

  Modified:    src/java/org/apache/ecs GenericElement.java
  Log:
  International character set bug fix
  
  Revision  Changes    Path
  1.20      +23 -18    jakarta-ecs/src/java/org/apache/ecs/GenericElement.java
  
  Index: GenericElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ecs/src/java/org/apache/ecs/GenericElement.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- GenericElement.java	2001/04/12 14:24:06	1.19
  +++ GenericElement.java	2001/06/03 14:33:02	1.20
  @@ -52,6 +52,8 @@
    */
   package org.apache.ecs;
   
  +import java.io.Writer;
  +import java.io.StringWriter;
   import java.io.PrintWriter;
   import java.io.OutputStream;
   import java.io.BufferedOutputStream;
  @@ -65,7 +67,7 @@
   /**
       This class implements the ElementFactory.
   
  -    @version $Id: GenericElement.java,v 1.19 2001/04/12 14:24:06 snagy Exp $
  +    @version $Id: GenericElement.java,v 1.20 2001/06/03 14:33:02 rdonkin Exp $
       @author <a href="mailto:snagy@servletapi.com">Stephan Nagy</a>
       @author <a href="mailto:jon@clearink.com">Jon S. Stevens</a>
   */
  @@ -715,27 +717,22 @@
       */
       public final String toString()
       {
  -       String out = null;
  -       try
  +        StringWriter write = new StringWriter();
  +        String out = null;
  +        try
           {
  -            ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -            BufferedOutputStream bos = new BufferedOutputStream(baos);
  -            output(bos);
  -            bos.flush();
  -            
  -            if ( getCodeSet() != null ) 
  -            {
  -                out = baos.toString(getCodeSet());
  -            } else 
  -            {
  -                out = baos.toString();
  -            }
  -            
  -            bos.close();
  -            baos.close();
  +            output(write);
  +            write.flush();
  +            out = write.toString();
  +            write.close();
  +        }
  +        catch (UnsupportedEncodingException use)
  +        {
  +            use.printStackTrace();
           }
           catch (IOException ioe)
           {
  +            ioe.printStackTrace();
           }
           return(out);
       }
  @@ -821,6 +818,14 @@
           if (getNeedClosingTag())
               out.write(createEndTag());
   
  +    }
  +
  +    /**
  +        Writer version of this method.
  +    */
  +    public void output(Writer out)
  +    {
  +        output ( new PrintWriter(out) );
       }
   
   	/**
  
  
  

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


Mime
View raw message