|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.drda.DRDAString
final class DRDAString
This class provides functionality for reusing buffers and strings
when parsing DRDA packets. A byte array representing a string is
stored internally. When the string is requested as a
String object, the byte array is converted to a
string, and the string is cached to avoid unnecessary conversion
later.
| Field Summary | |
|---|---|
private byte[] |
buffer
Buffer representing the string. |
private java.lang.String |
cachedString
The previously generated string. |
private boolean |
modified
True if the contents were modified in the previous call to setBytes. |
private DDMWriter |
writer
Keep the DDMWriter as it contains the current CCSID manager being used |
| Constructor Summary | |
|---|---|
DRDAString(DDMWriter w)
Create a new DRDAString instance. |
|
| Method Summary | |
|---|---|
private boolean |
equalTo(byte[] buf,
int offset,
int size)
Check whether the internal buffer contains the same data as another byte buffer. |
byte[] |
getBytes()
Return the internal byte array. |
int |
length()
Return the length in bytes of the internal string representation. |
void |
setBytes(byte[] src,
int offset,
int size)
Modify the internal byte buffer. |
java.lang.String |
toString()
Convert the internal byte array to a string. |
boolean |
wasModified()
Check whether the contents of the DRDAString were
modified in the previous call to setBytes(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private byte[] buffer
private final DDMWriter writer
private boolean modified
setBytes.
private java.lang.String cachedString
| Constructor Detail |
|---|
DRDAString(DDMWriter w)
DRDAString instance.
w - a DDMWriter which holds current CCSidManager
and which encoding is used| Method Detail |
|---|
private boolean equalTo(byte[] buf,
int offset,
int size)
buf - a byte arrayoffset - start position in the byte arraysize - how many bytes to read from the byte array
true if the internal buffer contains the
same data as the specified byte array
public void setBytes(byte[] src,
int offset,
int size)
src - the new bytesoffset - start offsetsize - number of bytes to usepublic boolean wasModified()
DRDAString were
modified in the previous call to setBytes().
true if the contents were modifiedpublic java.lang.String toString()
toString in class java.lang.ObjectString valuepublic int length()
public byte[] getBytes()
DRDAString. The value of the array might be
modified by subsequent calls to
DRDAString.setBytes().
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||