com.ctc.wstx.io
Class UTFTextWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
          extended by com.ctc.wstx.io.WriterBase
              extended by com.ctc.wstx.io.UTFTextWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class UTFTextWriter
extends WriterBase

Basic escaping writer used when outputting normal textual content. Only needs to escape '<' and '&' characters, plus '>' when following "]]" string. Note that to detect the last case, the logic is bit simplified, so that any '>' that immediately follows a ']' gets escaped. Further, since the Writer does not know of text segment boundaries, it is possible that there is no immediate sequence in the output. This is not a correctness problem, however (since such escaping is perfectly legal, although not strictly necessary), just a slightly "unoptimal" behaviour.


Field Summary
 
Fields inherited from class com.ctc.wstx.io.WriterBase
CHAR_NULL, CHAR_SPACE, HIGHEST_ENCODABLE_ATTR_CHAR, HIGHEST_ENCODABLE_TEXT_CHAR, mEntityBuffer, STR_ESCAPED_CR
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
UTFTextWriter(java.io.Writer out, java.lang.String enc, boolean escapeCR)
           
 
Method Summary
 void write(char[] cbuf, int offset, int len)
           
 void write(int c)
           
 void write(java.lang.String str, int offset, int len)
           
 
Methods inherited from class com.ctc.wstx.io.WriterBase
getQuoteEntity, throwNullChar, writeAsEntity
 
Methods inherited from class java.io.FilterWriter
close, flush
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UTFTextWriter

public UTFTextWriter(java.io.Writer out,
                     java.lang.String enc,
                     boolean escapeCR)
Parameters:
enc - Name of actual encoding in use; ignored for UTF writers
escapeCR - If true, will encode \r character; if false, will output as is (former is needed for reliable round-tripping, but adds verbosity without necessary benefits)
Method Detail

write

public void write(int c)
           throws java.io.IOException
Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException

write

public void write(char[] cbuf,
                  int offset,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException

write

public void write(java.lang.String str,
                  int offset,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException