Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)

com.lapetus_ltd.api.db.control
Class TLptsRowSetStringObject

java.lang.Object
  extended by com.lapetus_ltd.api.db.control.TLptsRowSetStringObject

public class TLptsRowSetStringObject
extends java.lang.Object

Class Description : This is the character set processing class for String types from the RowSet.

This class processes bytes to String objects using the given character set.

$LastChangedRevision: 1165 $
$LastChangedDate:: 2010-11-03 10:37:03#$


Constructor Summary
TLptsRowSetStringObject(byte[] bytes, java.lang.String charset)
          
This is the constructor of TLptsRowSetStringObject.
TLptsRowSetStringObject(java.lang.String string, byte[] bytes)
          
This is the constructor of TLptsRowSetStringObject.
 
Method Summary
 java.lang.String getString()
          Gets the string supplied to this object.
 java.lang.String getString(java.lang.String charSet)
          Gets the string for this object using the supplied bytes and the parameter charset.
 java.lang.String toString()
          This is identical to calling getString() on this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TLptsRowSetStringObject

public TLptsRowSetStringObject(byte[] bytes,
                               java.lang.String charset)

This is the constructor of TLptsRowSetStringObject.

The string that is encoded here is stored and used by the getString().
The bytes are used in calls to getString(String) to encode the result with the new charset.

Parameters:
bytes - The raw bytes required to encode the string. These bytes normally come from the resultset.
charset - The character set to use for the encoding of the string.

TLptsRowSetStringObject

public TLptsRowSetStringObject(java.lang.String string,
                               byte[] bytes)

This is the constructor of TLptsRowSetStringObject.

The string that is stored her is used by the getString().
The bytes are used in calls to getString(String) to encode the result with the new charset.

Parameters:
string - The string value to store in the object.
bytes - The raw bytes required to encode the string. These bytes normally come from the resultset.
Method Detail

getString

public java.lang.String getString()
Gets the string supplied to this object.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : N/A

Notes :

Example :

 // Two different ways to set the internal string object.
 TLptsRowSetStringObject rco = new TLptsRowSetStringObject(stringBytes,"UTF-8");
 // OR
 TLptsRowSetStringObject rco = new TLptsRowSetStringObject(string,stringBytes);
 String internalString = rco.getString();
 // OR
 String internalString = rco.getString("UTF-8");

 // assuming that the string and stringBytes are from the same string,
 // then the internal strings should be the same in both cases.
 

Returns:
The string as supplied to this object.

getString

public java.lang.String getString(java.lang.String charSet)
Gets the string for this object using the supplied bytes and the parameter charset.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : N/A

Notes :

Example :

 // Two different ways to set the internal string object.
 TLptsRowSetStringObject rco = new TLptsRowSetStringObject(stringBytes,"UTF-8");
 // OR
 TLptsRowSetStringObject rco = new TLptsRowSetStringObject(string,stringBytes);
 String internalString = rco.getString();
 // OR
 String internalString = rco.getString("UTF-8");

 // assuming that the string and stringBytes are from the same string,
 // then the internal strings should be the same in both cases.
 

Parameters:
charSet - The character set to use for encoding the bytes of this object.
Returns:
The string that results from encoding the bytes with the supplied charset.

toString

public java.lang.String toString()
This is identical to calling getString() on this object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.


Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)