Java SDK Documentation  8.1
com.vertica.sdk.VString Class Reference

Representation of a String in Vertica. All character data is internally encoded as UTF-8 characters and is not NULL terminated. More...

Collaboration diagram for com.vertica.sdk.VString:
Collaboration graph

Public Member Functions

 VString (ByteBuffer buf, int offset, int totalMaxLen)
 Contruct a VString object. More...
 
 VString (ByteBuffer hbuf, ByteBuffer dbuf, int hoffset, int doffset, int maxDataLen)
 Construct an out of line VString object. More...
 
void copy (byte[] from)
 Copy character data from byte array to the VString's internal buffer. More...
 
void copy (String from)
 Copy character data from String. More...
 
void copy (VString from)
 Copy data from another VString. More...
 
ByteBuffer data ()
 Provides a read-only ByteBuffer to this VString's internal character data. More...
 
boolean isNull ()
 Indicates if this VString contains the SQL NULL value. More...
 
int length ()
 Returns the length of this VString. More...
 
void setNull ()
 Sets this VString to the SQL NULL value.
 
String str ()
 Provides a copy of this VString's data as a Java String. More...
 
String toString ()
 

Detailed Description

Representation of a String in Vertica. All character data is internally encoded as UTF-8 characters and is not NULL terminated.

Constructor & Destructor Documentation

com.vertica.sdk.VString.VString ( ByteBuffer  buf,
int  offset,
int  totalMaxLen 
)

Contruct a VString object.

Parameters
bufthe ByteBuffer providing the space to back the VString
offsetoffset of the beginning of VString into the ByteBuffer
totalMaxLenthe maximum length of the string structure including the header
com.vertica.sdk.VString.VString ( ByteBuffer  hbuf,
ByteBuffer  dbuf,
int  hoffset,
int  doffset,
int  maxDataLen 
)

Construct an out of line VString object.

Parameters
hbufthe ByteBuffer with the VString header
dbufthe ByteBuffer with the actual data
hoffsetof the beginning of VString header in hbuf
doffsetoffset of the actual string data
maxDataLenmaximum length of the string structure not including the header

Member Function Documentation

void com.vertica.sdk.VString.copy ( byte[]  from)

Copy character data from byte array to the VString's internal buffer.

Parameters
fromarray of bytes input data
void com.vertica.sdk.VString.copy ( String  from)

Copy character data from String.

Parameters
fromJava String object as character input data
void com.vertica.sdk.VString.copy ( VString  from)

Copy data from another VString.

Parameters
fromThe source VString
ByteBuffer com.vertica.sdk.VString.data ( )

Provides a read-only ByteBuffer to this VString's internal character data.

Returns
the read only character data for this string in a ByteBuffer
Note
The returned string is not null terminated
boolean com.vertica.sdk.VString.isNull ( )

Indicates if this VString contains the SQL NULL value.

Returns
true if this string contains the SQL NULL value, false otherwise

Referenced by com.vertica.sdk.VString.str().

int com.vertica.sdk.VString.length ( )

Returns the length of this VString.

Returns
the length of the string, in bytes. Does not include any extra space for null characters.

Referenced by com.vertica.sdk.VString.isNull(), and com.vertica.sdk.VString.str().

String com.vertica.sdk.VString.str ( )

Provides a copy of this VString's data as a Java String.

Returns
a Java String copy of the data in this VString