org.kohsuke.stapler.framework.io
Class LineEndNormalizingWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
          extended by org.kohsuke.stapler.framework.io.LineEndNormalizingWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class LineEndNormalizingWriter
extends java.io.FilterWriter

Finds the lone LF and converts that to CR+LF.

Internet Explorer's XmlHttpRequest.responseText seems to normalize the line end, and if we only send LF without CR, it will not recognize that as a new line. To work around this problem, we use this filter to always convert LF to CR+LF.

Author:
Kohsuke Kawaguchi

Field Summary
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
LineEndNormalizingWriter(java.io.Writer out)
           
 
Method Summary
 void write(char[] cbuf)
           
 void write(char[] cbuf, int off, int len)
           
 void write(int c)
           
 void write(java.lang.String str)
           
 void write(java.lang.String str, int off, int len)
           
 
Methods inherited from class java.io.FilterWriter
close, flush
 
Methods inherited from class java.io.Writer
append, append, append
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineEndNormalizingWriter

public LineEndNormalizingWriter(java.io.Writer out)
Method Detail

write

public void write(char[] cbuf)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(java.lang.String str)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

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 off,
                  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 off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException


Copyright © 2011. All Rights Reserved.