org.apache.maven.doxia.util

Class LineBreaker

public class LineBreaker extends Object

Allows to specify the line-length of an output writer.
Field Summary
static intDEFAULT_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
voidclose()
Close the writer.
voidflush()
Write out the current StringBuffer and flush the writer.
WritergetDestination()
Returns the current destination writer.
voidwrite(String text)
Writes the given text to the writer.
voidwrite(String text, boolean preserveSpace)
Writes the given text to the writer.

Field Detail

DEFAULT_MAX_LINE_LENGTH

public static final int DEFAULT_MAX_LINE_LENGTH
The default maximal line length.

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

close

public void close()
Close the writer.

flush

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

getDestination

public Writer getDestination()
Returns the current destination writer.

Returns: The destination.

write

public void write(String text)
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.

Copyright © 2002-2011 Apache Software Foundation. All Rights Reserved.