|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.archive.util.PaddingStringBuffer
public final class PaddingStringBuffer
StringBuffer-like utility which can add spaces to reach a certain column. It
allows you to append String
, long
and int
s
to the buffer.
Note: This class counts from 1, not 0.
It uses a StringBuffer behind the scenes.
To write a string with multiple lines, it is advisible to use the
newline()
function. Regular appending of strings with
newlines (\n) character should be safe though. Right appending of strings
with such characters is not safe.
Field Summary | |
---|---|
(package private) java.lang.StringBuffer |
buffer
|
(package private) int |
linePos
|
Constructor Summary | |
---|---|
PaddingStringBuffer()
Create a new PaddingStringBuffer |
Method Summary | |
---|---|
PaddingStringBuffer |
append(int i)
append an int to the buffer. |
PaddingStringBuffer |
append(long lo)
append a long to the buffer. |
PaddingStringBuffer |
append(java.lang.String string)
append a string directly to the buffer |
PaddingStringBuffer |
newline()
Forces a new line in the buffer. |
PaddingStringBuffer |
padTo(int col)
Pad to a given column. |
PaddingStringBuffer |
raAppend(int col,
int i)
Append an int right-aligned to the given column. |
PaddingStringBuffer |
raAppend(int col,
long lo)
Append a long , right-aligned to the given column. |
PaddingStringBuffer |
raAppend(int col,
java.lang.String string)
Append a string, right-aligned to the given columm. |
void |
reset()
reset the buffer back to empty |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
java.lang.StringBuffer buffer
int linePos
Constructor Detail |
---|
public PaddingStringBuffer()
Method Detail |
---|
public PaddingStringBuffer append(java.lang.String string)
string
- the string to append
public PaddingStringBuffer raAppend(int col, java.lang.String string)
col
- the column to right-align tostring
- the string, must not contain multiple lines.
public PaddingStringBuffer padTo(int col)
col
-
i
.public PaddingStringBuffer append(int i)
int
to the buffer.
i
- the int to append
i
appended.public PaddingStringBuffer raAppend(int col, int i)
int
right-aligned to the given column. If the
buffer length is already greater than the column specified, it simply
appends the int
.
col
- the column to right-align toi
- the int to append
public PaddingStringBuffer append(long lo)
long
to the buffer.
lo
- the long
to append
public PaddingStringBuffer raAppend(int col, long lo)
long
, right-aligned to the given column. If the
buffer length is already greater than the column specified, it simply
appends the long
.
col
- the column to right-align tolo
- the long to append
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object
public PaddingStringBuffer newline()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |