final class DRDAString
extends java.lang.Object
String
object, the byte array is converted to a
string, and the string is cached to avoid unnecessary conversion
later.Modifier and Type | Field | Description |
---|---|---|
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 | Description |
---|---|
DRDAString(DDMWriter w) |
Create a new
DRDAString instance. |
Modifier and Type | Method | Description |
---|---|---|
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() . |
private byte[] buffer
private final DDMWriter writer
private boolean modified
setBytes
.private java.lang.String cachedString
DRDAString(DDMWriter w)
DRDAString
instance.w
- a DDMWriter
which holds current CCSidManager
and which encoding is usedprivate 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 arraytrue
if the internal buffer contains the
same data as the specified byte arraypublic 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.Object
String
valuepublic int length()
public byte[] getBytes()
DRDAString
. The value of the array might be
modified by subsequent calls to
DRDAString.setBytes()
.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.