CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.io
Class LFWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
          extended by ch.randelshofer.io.LFWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class LFWriter
extends java.io.FilterWriter

A character-output stream that converts line terminators into a configurable line separator sequence.mbers. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.

Version:
1.1 2004-04-17 Constructor with lineSeparator parameter added.
1.0.1 2004-02-14 Method write accidentaly suppressed a line feed if it was the last character in the supplied data.
1.0 2002-02-13 Created.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
LFWriter(java.io.Writer out)
          Create a new line-numbering writer.
LFWriter(java.io.Writer out, java.lang.String lineSeparator)
          Create a new line-numbering writer.
 
Method Summary
 java.lang.String getLineSeparator()
          Gets the line separator of the println() methods.
 void setLineSeparator(java.lang.String lineSeparator)
          Sets the line separator for the println() methods.
 void write(char[] cbuf, int off, int len)
          Write a portion of an array of characters.
 void write(int c)
          Write a single character.
 void write(java.lang.String str, int off, int len)
          Write a portion of a string.
 
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

LFWriter

public LFWriter(java.io.Writer out)
Create a new line-numbering writer.


LFWriter

public LFWriter(java.io.Writer out,
                java.lang.String lineSeparator)
Create a new line-numbering writer.

Method Detail

getLineSeparator

public java.lang.String getLineSeparator()
Gets the line separator of the println() methods.


setLineSeparator

public void setLineSeparator(java.lang.String lineSeparator)
Sets the line separator for the println() methods.


write

public void write(int c)
           throws java.io.IOException
Write a single character.

Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException - If an I/O error occurs

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Write a portion of an array of characters.

Overrides:
write in class java.io.FilterWriter
Parameters:
cbuf - Buffer of characters to be written
off - Offset from which to start reading characters
len - Number of characters to be written
Throws:
java.io.IOException - If an I/O error occurs

write

public void write(java.lang.String str,
                  int off,
                  int len)
           throws java.io.IOException
Write a portion of a string.

Overrides:
write in class java.io.FilterWriter
Parameters:
str - String to be written
off - Offset from which to start reading characters
len - Number of characters to be written
Throws:
java.io.IOException - If an I/O error occurs

(c) Werner Randelshofer.
All rights reserved.