|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.luaj.vm2.Buffer
public final class Buffer
String buffer for use in string library methods, optimized for production of StrValue instances.
The buffer can begin initially as a wrapped LuaValue
and only when concatenation actually occurs are the bytes first copied.
To convert back to a LuaValue
again,
the function value()
is used.
LuaValue
,
LuaValue.buffer()
,
LuaString
Constructor Summary | |
---|---|
Buffer()
Create buffer with default capacity |
|
Buffer(int initialCapacity)
Create buffer with specified initial capacity |
|
Buffer(LuaValue value)
Create buffer with specified initial value |
Method Summary | |
---|---|
Buffer |
append(byte b)
Append a single byte to the buffer. |
Buffer |
append(LuaString str)
Append a LuaString to the buffer. |
Buffer |
append(LuaValue val)
Append a LuaValue to the buffer. |
Buffer |
append(java.lang.String str)
Append a Java String to the buffer. |
Buffer |
concatTo(LuaNumber lhs)
Concatenate this buffer onto a LuaNumber |
Buffer |
concatTo(LuaString lhs)
Concatenate this buffer onto a LuaString |
Buffer |
concatTo(LuaValue lhs)
Concatenate this buffer onto a LuaValue |
void |
makeroom(int nbefore,
int nafter)
Ensure there is enough room before and after the bytes. |
Buffer |
prepend(LuaString s)
Concatenate bytes from a LuaString onto the front of this buffer |
Buffer |
setvalue(LuaValue value)
Set buffer contents as a LuaValue |
java.lang.String |
tojstring()
Convert the buffer to a Java String |
LuaString |
tostring()
Convert the buffer to a LuaString |
java.lang.String |
toString()
Convert the buffer to a Java String |
LuaValue |
value()
Get buffer contents as a LuaValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Buffer()
DEFAULT_CAPACITY
public Buffer(int initialCapacity)
initialCapacity
- the initial capacitypublic Buffer(LuaValue value)
value
- the initial valueMethod Detail |
---|
public LuaValue value()
LuaValue
LuaValue
, converting as necessarypublic Buffer setvalue(LuaValue value)
LuaValue
value
- value to setpublic final LuaString tostring()
LuaString
LuaString
public java.lang.String tojstring()
public java.lang.String toString()
toString
in class java.lang.Object
public final Buffer append(byte b)
this
to allow call chainingpublic final Buffer append(LuaValue val)
LuaValue
to the buffer.
this
to allow call chainingpublic final Buffer append(LuaString str)
LuaString
to the buffer.
this
to allow call chainingpublic final Buffer append(java.lang.String str)
this
to allow call chainingLuaString.encodeToUtf8(char[], byte[], int)
public Buffer concatTo(LuaValue lhs)
LuaValue
lhs
- the left-hand-side value onto which we are concatenating this
Buffer
for use in call chaining.public Buffer concatTo(LuaString lhs)
LuaString
lhs
- the left-hand-side value onto which we are concatenating this
Buffer
for use in call chaining.public Buffer concatTo(LuaNumber lhs)
LuaNumber
The LuaNumber
will be converted to a string before concatenating.
lhs
- the left-hand-side value onto which we are concatenating this
Buffer
for use in call chaining.public Buffer prepend(LuaString s)
LuaString
onto the front of this buffer
s
- the left-hand-side value which we will concatenate onto the front of this
Buffer
for use in call chaining.public final void makeroom(int nbefore, int nafter)
nbefore
- number of unused bytes which must precede the data after this completesnafter
- number of unused bytes which must follow the data after this completes
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |