public class GenBuffer extends Writer
| Modifier and Type | Field and Description |
|---|---|
protected int |
bufferCount |
protected int |
curOut |
protected int |
INITIAL_BUFFER_CAPACITY |
protected StringBuffer[] |
listOut |
protected Stack |
selectStack |
| Constructor and Description |
|---|
GenBuffer(GenBuffer source) |
GenBuffer(int bufferCount) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
anyContent()
Has anything actually been written here?
|
protected void |
beforeWriteHook()
This method will get called before any write occurs.
|
void |
close()
This method has no effect.
|
void |
ensureCapacity(int minimumCapacity)
Ensures the capacity of every buffer is at least @param minimumCapacity.
|
void |
flush()
This does nothing as we're all in memory.
|
StringBuffer |
getBuffer()
Return the active StringBuffer
|
int |
getCurrentPosition() |
void |
insertAdditionalBuffers(int offset,
int count)
Insert some additional buffers.
|
void |
popSelect() |
void |
pushSelect(int bufferNum) |
void |
reset()
Reset the buffers so that you can use it again.
|
void |
select(int bufferNum)
Select the current buffer to use as output.
|
void |
setFirst(String separator)
setFirst and writeNext work in together to allow easier generation
or lists where the items in the list are separated by some text
between each of them.
|
void |
truncateAtPosition(int pos) |
void |
write(boolean b)
Append the parameter to the current buffer.
|
void |
write(char c)
Append the parameter to the current buffer.
|
void |
write(char[] str)
Append the parameter to the current buffer.
|
void |
write(char[] cbuf,
int off,
int len) |
void |
write(double d)
Append the parameter to the current buffer.
|
void |
write(float f)
Append the parameter to the current buffer.
|
void |
write(int i)
Append the parameter to the current buffer *as a character*.
|
void |
write(long l)
Append the parameter to the current buffer *as a character*.
|
void |
write(Object obj)
Append the parameter to the current buffer.
|
void |
write(String s)
write @param s to the current buffer
|
void |
write(StringBuffer s)
write @param s to the current buffer
|
void |
write(String str,
int bufferNum) |
void |
write(String s1,
String s2)
write @param s1 and @param s2 to the current buffer just as if
2 separate writes were done.
|
void |
write(String s1,
String s2,
String s3)
write @param s1, @param s2, and @param s3 to the current buffer
just as if 3 separate writes were done.
|
void |
write(String s1,
String s2,
String s3,
String s4)
write @param s1, @param s2, @param s3, and @param s4 to the current buffer
just as if 3 separate writes were done.
|
void |
writeNext()
Begin the next in the sequence.
|
void |
writeNext(String msg)
Write the next text in the sequence.
|
void |
writeNext(String msg1,
String msg2)
Write the next text in the sequence.
|
void |
writeNext(String msg1,
String msg2,
String msg3)
Write the next text in the sequence.
|
void |
writeTo(GenBuffer out) |
void |
writeTo(OutputStream out)
Send buffers to @param out
|
void |
writeTo(StringBuffer out) |
void |
writeTo(Writer out)
Send buffers to @param out
|
protected int INITIAL_BUFFER_CAPACITY
protected int curOut
protected StringBuffer[] listOut
protected int bufferCount
protected Stack selectStack
public GenBuffer(int bufferCount)
bufferCount - is the number of buffers to create.public GenBuffer(GenBuffer source)
public void reset()
public void insertAdditionalBuffers(int offset,
int count)
public void close()
public void flush()
public void select(int bufferNum)
public void pushSelect(int bufferNum)
public void popSelect()
protected void beforeWriteHook()
public void write(boolean b)
throws IOException
IOExceptionpublic void write(char c)
throws IOException
IOExceptionpublic void write(char[] str)
throws IOException
write in class WriterIOExceptionpublic void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOExceptionWriterpublic void write(double d)
throws IOException
IOExceptionpublic void write(float f)
throws IOException
IOExceptionpublic void write(int i)
throws IOException
write in class WriterIOExceptionpublic void write(long l)
throws IOException
IOExceptionpublic void write(Object obj) throws IOException
IOExceptionStringBufferpublic void write(String s) throws IOException
write in class WriterIOExceptionpublic void write(StringBuffer s) throws IOException
IOExceptionpublic void write(String s1, String s2) throws IOException
IOExceptionpublic void write(String s1, String s2, String s3) throws IOException
IOExceptionpublic void write(String s1, String s2, String s3, String s4) throws IOException
IOExceptionpublic void write(String str, int bufferNum) throws IOException
IOExceptionpublic void setFirst(String separator)
public void writeNext(String msg) throws IOException
IOExceptionpublic void writeNext(String msg1, String msg2) throws IOException
IOExceptionpublic void writeNext(String msg1, String msg2, String msg3) throws IOException
IOExceptionpublic void writeNext()
throws IOException
IOExceptionpublic void writeTo(Writer out) throws IOException
IOExceptionpublic void writeTo(OutputStream out) throws IOException
IOExceptionpublic void writeTo(StringBuffer out)
public void writeTo(GenBuffer out)
public boolean anyContent()
public int getCurrentPosition()
public void truncateAtPosition(int pos)
public StringBuffer getBuffer()
public void ensureCapacity(int minimumCapacity)
Copyright © 2017. All Rights Reserved.