net.sf.fikin.ant.types
Class DelimitedBufferedWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.BufferedWriter
          extended by net.sf.fikin.ant.types.DelimitedBufferedWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class DelimitedBufferedWriter
extends java.io.BufferedWriter

Buffered writer with ability to overwrite new-line character.

By setting the delimiter to some some string, calls to newLine() will result in printing the given string.

In case the delimiter is null it printing fails to default implementation. created on Jan 4, 2007

Since:
Version:
$Revision: 1.3 $
Author:
fiykov

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
DelimitedBufferedWriter(java.io.Writer out, int sz, java.lang.String delimiter)
          Create a new buffered character-output stream that uses an output buffer of the given size.
DelimitedBufferedWriter(java.io.Writer out, java.lang.String delimiter)
          Create a buffered character-output stream that uses a default-sized output buffer.
 
Method Summary
 java.lang.String getDelimiter()
          Get the assigned delimiter.
 void setDelimiter(java.lang.String delimiter)
          set the delimiter to use, can be null (resulting in default newLine() handling then)
 
Methods inherited from class java.io.BufferedWriter
close, flush, newLine, write, write, write
 
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

DelimitedBufferedWriter

public DelimitedBufferedWriter(java.io.Writer out,
                               java.lang.String delimiter)
Create a buffered character-output stream that uses a default-sized output buffer.

Parameters:
out - A Writer

DelimitedBufferedWriter

public DelimitedBufferedWriter(java.io.Writer out,
                               int sz,
                               java.lang.String delimiter)
Create a new buffered character-output stream that uses an output buffer of the given size.

Parameters:
out - A Writer
sz - Output-buffer size, a positive integer
Throws:
java.lang.IllegalArgumentException - If sz is <= 0
Method Detail

setDelimiter

public void setDelimiter(java.lang.String delimiter)
set the delimiter to use, can be null (resulting in default newLine() handling then)

Parameters:
delimiter -

getDelimiter

public java.lang.String getDelimiter()
Get the assigned delimiter.

This is given during writer instantiation and it has been specified by the user in the "output" tag

It defaults for single space for writing in a Ant property and System.getProperty("line.separator") for writing in a file

Returns:
assigned delimiter


Copyright © 2003-2007 Nikolay Fiykov. All Rights Reserved.