|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.monica.javacom.util.MJCStringBuffer
This class provides a buffer functionality. The buffer provides locking, adding of byte arrays, chars, char arrays, Strings, retrieving the buffer in synchronized way. The StringBuffer functionality means that the following types can be added, and a String can be received from the objects added, where the objects will be concatenated in the order of their addition to the buffer.
Constructor Summary | |
MJCStringBuffer(int maxBufferLength)
Constructs the buffer. |
Method Summary | |
boolean |
addToBuffer(byte[] b)
Adds a byte array to the buffer. |
boolean |
addToBuffer(byte[] b,
int l)
Adds the first l bytes of the byte array to the buffer. |
boolean |
addToBuffer(byte[] b,
int off,
int len)
Adds a part of byte array specified with offset and length to the buffer. |
boolean |
addToBuffer(char c)
Adds a single char to the buffer. |
boolean |
addToBuffer(char[] c)
Adds a char array to the buffer. |
boolean |
addToBuffer(char[] c,
int off,
int len)
Adds a part of char array specified with offset and length to the buffer. |
boolean |
addToBuffer(java.lang.String s)
Adds a String to the buffer. |
boolean |
addToBuffer(java.lang.String s,
int off,
int len)
Adds a part of a String specified with offset and length to the buffer. |
int |
available()
Returns the number of bytes that can still be added to the buffer without rejection. |
boolean |
clearBuffer()
|
java.lang.String |
emptyBuffer()
Returns the contents of the buffer. |
java.lang.String |
emptyBuffer(int f)
Returns the first f bytes of the buffer. |
java.lang.String |
getBuffer()
Returns the contents of the buffer. |
int |
getBufferLength()
Returns the actual length of the buffer. |
int |
getMaxBufferLength()
Returns the maximal length of the contents of the buffer. |
boolean |
lock()
Locks the buffer. |
boolean |
lockStatus()
Returns the status of the locking of the buffer. |
void |
unlock()
Unlocks the buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MJCStringBuffer(int maxBufferLength)
int
- maxBufferLength: the maximal length of the contents of the bufferMethod Detail |
public boolean lock()
public void unlock()
public int getMaxBufferLength()
public int getBufferLength()
public boolean addToBuffer(byte[] b)
byte[]
- b: the byte array to be addedpublic boolean addToBuffer(byte[] b, int l)
byte
- b[]: the byte array to be addedint
- l: the length of the byte arraypublic boolean addToBuffer(byte[] b, int off, int len)
byte
- b[]: the byte array to be addedint
- off: the beginning offset of the part (inclusive)int
- len: the length of the partpublic boolean addToBuffer(char[] c)
char[]
- c: the char array to be addedpublic boolean addToBuffer(char[] c, int off, int len)
char
- b[]: the char array to be addedint
- off: the beginning offset of the part (inclusive)int
- len: the length of the partpublic boolean addToBuffer(char c)
char
- c: the char to be addedpublic boolean addToBuffer(java.lang.String s)
String
- s: the String to be addedpublic boolean addToBuffer(java.lang.String s, int off, int len)
String
- s: the String to be addedint
- off: the beginning offset of the part (inclusive)int
- len: the length of the partpublic java.lang.String emptyBuffer()
public java.lang.String emptyBuffer(int f)
int
- f: the length of the requested part of the bufferpublic java.lang.String getBuffer()
public boolean lockStatus()
public int available()
public boolean clearBuffer()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |