< prev index next >

src/java.xml/share/classes/com/sun/xml/internal/stream/writers/UTF8OutputStreamWriter.java

Print this page




  25 
  26 package com.sun.xml.internal.stream.writers;
  27 
  28 import java.io.Writer;
  29 import java.io.OutputStream;
  30 import java.io.IOException;
  31 
  32 import com.sun.org.apache.xerces.internal.util.XMLChar;
  33 
  34 /**
  35  * <p>This class is used to write a stream of chars as a stream of
  36  * bytes using the UTF8 encoding. It assumes that the underlying
  37  * output stream is buffered or does not need additional buffering.</p>
  38  *
  39  * <p>It is more efficient than using a <code>java.io.OutputStreamWriter</code>
  40  * because it does not need to be wrapped in a
  41  * <code>java.io.BufferedWriter</code>. Creating multiple instances
  42  * of <code>java.io.BufferedWriter</code> has been shown to be very
  43  * expensive in JAX-WS.</p>
  44  *
  45  * @author Santiago.PericasGeertsen@sun.com
  46  */
  47 public final class UTF8OutputStreamWriter extends Writer {
  48 
  49     /**
  50      * Undelying output stream. This class assumes that this
  51      * output stream does not need buffering.
  52      */
  53     OutputStream out;
  54 
  55     /**
  56      * Java represents chars that are not in the Basic Multilingual
  57      * Plane (BMP) in UTF-16. This int stores the first code unit
  58      * for a code point encoded in two UTF-16 code units.
  59      */
  60     int lastUTF16CodePoint = 0;
  61 
  62     public UTF8OutputStreamWriter(OutputStream out) {
  63         this.out = out;
  64     }
  65 




  25 
  26 package com.sun.xml.internal.stream.writers;
  27 
  28 import java.io.Writer;
  29 import java.io.OutputStream;
  30 import java.io.IOException;
  31 
  32 import com.sun.org.apache.xerces.internal.util.XMLChar;
  33 
  34 /**
  35  * <p>This class is used to write a stream of chars as a stream of
  36  * bytes using the UTF8 encoding. It assumes that the underlying
  37  * output stream is buffered or does not need additional buffering.</p>
  38  *
  39  * <p>It is more efficient than using a <code>java.io.OutputStreamWriter</code>
  40  * because it does not need to be wrapped in a
  41  * <code>java.io.BufferedWriter</code>. Creating multiple instances
  42  * of <code>java.io.BufferedWriter</code> has been shown to be very
  43  * expensive in JAX-WS.</p>
  44  *
  45  * @author Santiago PericasGeertsen
  46  */
  47 public final class UTF8OutputStreamWriter extends Writer {
  48 
  49     /**
  50      * Undelying output stream. This class assumes that this
  51      * output stream does not need buffering.
  52      */
  53     OutputStream out;
  54 
  55     /**
  56      * Java represents chars that are not in the Basic Multilingual
  57      * Plane (BMP) in UTF-16. This int stores the first code unit
  58      * for a code point encoded in two UTF-16 code units.
  59      */
  60     int lastUTF16CodePoint = 0;
  61 
  62     public UTF8OutputStreamWriter(OutputStream out) {
  63         this.out = out;
  64     }
  65 


< prev index next >