|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
java.io.PrintWriter
com.overzealous.remark.util.BlockWriter
public final class BlockWriter
This is a customized subclass of BufferedWriter that handles working with Markdown block-level elements. In the case of a non-block-level element occurring outside a block, it is automatically promoted.
Field Summary |
---|
Fields inherited from class java.io.PrintWriter |
---|
out |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
BlockWriter(OutputStream out)
|
|
BlockWriter(OutputStream out,
boolean autoFlush)
|
|
BlockWriter(Writer out)
|
|
BlockWriter(Writer out,
boolean autoFlush)
|
Method Summary | |
---|---|
static BlockWriter |
create()
Creates a new, empty BlockWriter with a StringWriter as the buffer. |
static BlockWriter |
create(int initialSize)
Creates a new, empty BlockWriter with a StringWriter as the buffer. |
void |
endBlock()
Ends a block. |
int |
getBlockDepth()
Returns how deep the number of blocks is. |
StringWriter |
getBuffer()
If this object has been created using create() , returns the StringWriter output buffer. |
String |
getPrependNewlineString()
Returns the string being prepended to new lines, if set. |
boolean |
isEmpty()
Returns true if nothing has been written to the stream yet. |
void |
printBlock(Object blockText)
Alias for writeBlock(Object) . |
void |
println()
|
BlockWriter |
setPrependNewlineString(String prependNewLineString)
Sets the string to prepend to new lines. |
BlockWriter |
setPrependNewlineString(String prependNewLineString,
boolean skipFirstLine)
Sets the string to prepend to new lines. |
void |
startBlock()
Starts a new block. |
String |
toString()
If this object has been created using create() , this will return the contents
of the StringWriter buffer. |
void |
write(char[] cbuf,
int off,
int len)
|
void |
write(int c)
|
void |
write(String s,
int off,
int len)
|
void |
writeBlock(Object blockText)
Writes an entire block in one go. |
Methods inherited from class java.io.PrintWriter |
---|
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BlockWriter(Writer out)
public BlockWriter(Writer out, boolean autoFlush)
public BlockWriter(OutputStream out)
public BlockWriter(OutputStream out, boolean autoFlush)
Method Detail |
---|
public static BlockWriter create()
toString()
public static BlockWriter create(int initialSize)
initialSize
- Initialize the output buffer to the specified size.
toString()
public void write(int c)
write
in class PrintWriter
public void write(char[] cbuf, int off, int len)
write
in class PrintWriter
public void write(String s, int off, int len)
write
in class PrintWriter
public void println()
println
in class PrintWriter
public void startBlock()
endBlock()
is called when the block is completed.
public void endBlock()
public void writeBlock(Object blockText)
blockText
- The text of the block.public void printBlock(Object blockText)
writeBlock(Object)
.
blockText
- The text of the block.public int getBlockDepth()
0
means that no blocks are currently active.
public boolean isEmpty()
public StringWriter getBuffer()
create()
, returns the StringWriter output buffer.
public String getPrependNewlineString()
public BlockWriter setPrependNewlineString(String prependNewLineString)
prependNewLineString
- The string to prepend to each new line.
public BlockWriter setPrependNewlineString(String prependNewLineString, boolean skipFirstLine)
setPrependNewlineString(String)
.
prependNewLineString
- The string to prepend to each new line.skipFirstLine
- If true, the first line won't be prepended.
public String toString()
create()
, this will return the contents
of the StringWriter buffer.
Otherwise, this returns the default Object.toString() method.
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |