org.apache.maven.doxia.util
Class LineBreaker

java.lang.Object
  extended by org.apache.maven.doxia.util.LineBreaker

public class LineBreaker
extends Object

Allows to specify the line-length of an output writer.

Version:
$Id: LineBreaker.java 746978 2009-02-23 12:20:33Z vsiveton $

Field Summary
static int DEFAULT_MAX_LINE_LENGTH
          The default maximal line length.
 
Constructor Summary
LineBreaker(Writer out)
          Constructs a new LineBreaker with DEFAULT_MAX_LINE_LENGTH.
LineBreaker(Writer out, int max)
          Constructs a new LineBreaker with the given max line length.
 
Method Summary
 void close()
          Close the writer.
 void flush()
          Write out the current StringBuffer and flush the writer.
 Writer getDestination()
          Returns the current destination writer.
 void write(String text)
          Writes the given text to the writer.
 void write(String text, boolean preserveSpace)
          Writes the given text to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_LINE_LENGTH

public static final int DEFAULT_MAX_LINE_LENGTH
The default maximal line length.

See Also:
Constant Field Values
Constructor Detail

LineBreaker

public LineBreaker(Writer out)
Constructs a new LineBreaker with DEFAULT_MAX_LINE_LENGTH.

Parameters:
out - The writer to use.

LineBreaker

public LineBreaker(Writer out,
                   int max)
Constructs a new LineBreaker with the given max line length.

Parameters:
out - The writer to use.
max - The maximal line length.
Method Detail

getDestination

public Writer getDestination()
Returns the current destination writer.

Returns:
The destination.

write

public void write(String text)
           throws IOException
Writes the given text to the writer. White space is not preserved.

Parameters:
text - The text to write.
Throws:
IOException - if there's a problem writing the text.

write

public void write(String text,
                  boolean preserveSpace)
Writes the given text to the writer.

Parameters:
text - The text to write.
preserveSpace - True to preserve white space.

flush

public void flush()
Write out the current StringBuffer and flush the writer. Any IOException will be swallowed.


close

public void close()
Close the writer.



Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.