com.ctc.wstx.io
Class TextEscaper

java.lang.Object
  extended by com.ctc.wstx.io.TextEscaper

public final class TextEscaper
extends java.lang.Object


Method Summary
static java.io.Writer constructAttrValueWriter(java.io.Writer w, java.lang.String enc, char qchar)
           
static java.io.Writer constructTextWriter(java.io.Writer w, java.lang.String enc)
           
static int guessEncodingBitSize(java.lang.String enc)
          Method used to figure out which part of the Unicode char set the encoding can natively support.
static void outputDTDText(java.io.Writer w, char[] ch, int offset, int len)
          Quoting method used when outputting content that will be part of DTD (internal/external subset).
static void writeEscapedAttrValue(java.io.Writer w, java.lang.String value)
           
static void writeEscapedXMLText(java.io.Writer w, java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

constructAttrValueWriter

public static java.io.Writer constructAttrValueWriter(java.io.Writer w,
                                                      java.lang.String enc,
                                                      char qchar)
                                               throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

constructTextWriter

public static java.io.Writer constructTextWriter(java.io.Writer w,
                                                 java.lang.String enc)
                                          throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

writeEscapedXMLText

public static void writeEscapedXMLText(java.io.Writer w,
                                       java.lang.String text)
                                throws java.io.IOException
Throws:
java.io.IOException

writeEscapedAttrValue

public static void writeEscapedAttrValue(java.io.Writer w,
                                         java.lang.String value)
                                  throws java.io.IOException
Throws:
java.io.IOException

outputDTDText

public static void outputDTDText(java.io.Writer w,
                                 char[] ch,
                                 int offset,
                                 int len)
                          throws java.io.IOException
Quoting method used when outputting content that will be part of DTD (internal/external subset). Additional quoting is needed for percentage char, which signals parameter entities.

Throws:
java.io.IOException

guessEncodingBitSize

public static int guessEncodingBitSize(java.lang.String enc)
Method used to figure out which part of the Unicode char set the encoding can natively support. Values returned are 7, 8 and 16, to indicate (respectively) "ascii", "ISO-Latin" and "native Unicode". These just best guesses, but should work ok for the most common encodings.