All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oracle.sql.CHAR

oracle.sql.CHAR

public class CHAR
The Oracle specific representation of characters. The class extends oracle.sql.Datum and interprets the bytes according to one of the Oracle supported character sets. Each object of type oracle.sql.CHAR contains an indication of what character set to use in interpreting the bytes so one class can be used all all the variations, such as National Character Set, Client, Database, etc.

For conversions that are not supported directly by CHAR (e.g. "best effort" conversions from String) the programmer can a "best attempt" is wanted even when the conversion looses information, the "withReplacement" methods of oracle.sql.CharacterSet can be used directly.

See Also:
CharacterSet

Variable Index

 o DEFAULT_CHARSET

Constructor Index

 o CHAR(Object, CharacterSet)
Construct a CHAR from an Object.
 o CHAR(String, CharacterSet)
Constructor for CHAR.

Method Index

 o asciiStreamValue()
Convert to an ascii stream representation of the datum object
 o bigDecimalValue()
Convert this data object into a BigDecimal.
 o binaryStreamValue()
Convert to a binary stream representation of the datum object
 o booleanValue()
Convert to a boolean representation of the datum object
 o byteValue()
Convert to a byte representation of the datum object
 o characterStreamValue()
Convert to a character stream representation of the datum object
 o dateValue()
Convert to a Date representation of the datum object
 o doubleValue()
Convert to a double representation of the datum object
 o floatValue()
Convert to a float representation of the datum object
 o getString()
Converts the sequence of characters represented by this to a String.
 o intValue()
Convert to a integer representation of the datum object
 o isConvertibleTo(Class)
Test whether this data object can be converted to the specified Java data type.
 o longValue()
Convert to a long representation of the datum object
 o stringValue()
Convert this data object into a String.
 o timestampValue()
Convert to a Timestamp representation of the datum object
 o timeValue()
Convert to a Time representation of the datum object
 o toJdbc()
Convert this data object into its default Java object type.
 o toString()
Converts the characters to a String.

Variables

 o DEFAULT_CHARSET
 public static final CharacterSet DEFAULT_CHARSET

Constructors

 o CHAR
 public CHAR(String str,
             CharacterSet charSet) throws SQLException
Constructor for CHAR.
The String is first converted to the indicated character set. No provision is made for loss if the CharacterSet cannot represent all Unicode characters. Although perhaps some time in the future it may throw an exception in that case.

Parameters:
str - the sequence of characters (represented in Unicode).
charSet - the CharacterSet to which the string should be converted.
Throws: SQLException
if the attempt to convert str to charSet throws an exception. To avoid this, the program can first use CharacterSet.convertWithReplacement to get an array of bytes and then use the byte constructor.
 o CHAR
 public CHAR(Object obj,
             CharacterSet charSet) throws SQLException
Construct a CHAR from an Object.

Parameters:
obj input - data from which this class instance is constructed. This constructor calls obj.toString() to obtain the input string.
charSet character - set of the CHAR to be created.
Throws: SQLException
if the input argument 'obj' is an instance of an unsupported class, or if the input object cannot be converted into a CHAR.

Methods

 o getString
 public String getString() throws SQLException
Converts the sequence of characters represented by this to a String.

Returns:
a String containing the Unicode characters represented in this.
Throws: SQLException
if conversion from this.oracleId to UTF is not supported
Throws: SQLException
if the particular cannot characters cannot be converted without loss to Unicode.
 o toString
 public String toString()
Converts the characters to a String. Attempts to use getString, but if that throws an exception presents a hex representation of the individual bytes.

 o toJdbc
 public Object toJdbc() throws SQLException
Convert this data object into its default Java object type.

Returns:
the data value as a (fill in the blank) object.
Throws: SQLException
if any of the lower layer code throws an exception.
 o isConvertibleTo
 public boolean isConvertibleTo(Class jClass)
Test whether this data object can be converted to the specified Java data type.

Parameters:
jClass specifies - the Java data type to test against.
Returns:
true if this data object is convertible to the specified Java class, and a corresponding xxxValue() method is available; otherwise, a false is returned.
 o stringValue
 public String stringValue()
Convert this data object into a String.

Returns:
the data value in String representation.
 o booleanValue
 public boolean booleanValue() throws SQLException
Convert to a boolean representation of the datum object

Returns:
boolean representation of the datum object
Throws: SQLException,
if no boolean representation exists
 o intValue
 public int intValue() throws SQLException
Convert to a integer representation of the datum object

Returns:
integer representation of the datum object
Throws: SQLException,
if no integer representation exists
 o longValue
 public long longValue() throws SQLException
Convert to a long representation of the datum object

Returns:
long representation of the datum object
Throws: SQLException,
if no long representation exists
 o floatValue
 public float floatValue() throws SQLException
Convert to a float representation of the datum object

Returns:
float representation of the datum object
Throws: SQLException,
if no float representation exists
 o doubleValue
 public double doubleValue() throws SQLException
Convert to a double representation of the datum object

Returns:
double representation of the datum object
Throws: SQLException,
if no double representation exists
 o byteValue
 public byte byteValue() throws SQLException
Convert to a byte representation of the datum object

Returns:
byte representation of the datum object
Throws: SQLException,
if no byte representation exists
 o dateValue
 public Date dateValue() throws SQLException
Convert to a Date representation of the datum object

Returns:
java.sql.Date representation of the datum object
Throws: SQLException,
if no Date representation exists
 o timeValue
 public Time timeValue() throws SQLException
Convert to a Time representation of the datum object

Returns:
java.sql.Time representation of the datum object
Throws: SQLException,
if no Time representation exists
 o timestampValue
 public Timestamp timestampValue() throws SQLException
Convert to a Timestamp representation of the datum object

Returns:
java.sql.Timestamp representation of the datum object
Throws: SQLException,
if no Timestamp representation exists
 o bigDecimalValue
 public BigDecimal bigDecimalValue() throws SQLException
Convert this data object into a BigDecimal.

Returns:
the data value in BigDecimal representation.
 o characterStreamValue
 public Reader characterStreamValue() throws SQLException
Convert to a character stream representation of the datum object

Returns:
character stream representation of the datum object
Throws: SQLException,
if no character stream representation exists
 o asciiStreamValue
 public InputStream asciiStreamValue() throws SQLException
Convert to an ascii stream representation of the datum object

Returns:
ascii stream representation of the datum object
Throws: SQLException,
if no ascii stream representation exists
 o binaryStreamValue
 public InputStream binaryStreamValue() throws SQLException
Convert to a binary stream representation of the datum object

Returns:
binary stream representation of the datum object
Throws: SQLException,
if no binary stream representation exists

All Packages  Class Hierarchy  This Package  Previous  Next  Index