public class CHAR extends Datum
For conversions that are not supported directly by CHAR (e.g. "best effort" conversions from String), if the programer wants a "best attempt" even when the conversion looses information, the "withReplacement" methods of oracle.sql.CharacterSet can be used directly.
CharacterSet
,
Serialized FormModifier and Type | Field and Description |
---|---|
static CharacterSet |
DEFAULT_CHARSET |
ojiOracleDatumWithConnection, targetDatum
Modifier | Constructor and Description |
---|---|
protected |
CHAR() |
|
CHAR(java.lang.Object obj,
CharacterSet charSet)
Construct a CHAR from an Object.
|
|
CHAR(java.lang.String str,
CharacterSet charSet)
Constructor for CHAR.
|
|
CHAR(java.lang.String str,
CharacterSet charSet,
int len)
Constructor for CHAR.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
asciiStreamValue()
Convert to an ascii stream representation of the datum object
|
java.math.BigDecimal |
bigDecimalValue()
Convert this data object into a BigDecimal.
|
java.io.InputStream |
binaryStreamValue()
Convert to a binary stream representation of the datum object
|
boolean |
booleanValue()
Convert to a boolean representation of the datum object
|
byte |
byteValue()
Convert to a byte representation of the datum object
|
java.io.Reader |
characterStreamValue()
Convert to a character stream representation of the datum object
|
java.sql.Date |
dateValue()
Convert to a Date representation of the datum object
|
double |
doubleValue()
Convert to a double representation of the datum object
|
float |
floatValue()
Convert to a float representation of the datum object
|
protected oracle.jdbc.internal.OracleConnection |
getConnectionDuringExceptionHandling() |
java.lang.String |
getString()
Converts the sequence of characters represented by this to a String.
|
int |
intValue()
Convert to a integer representation of the datum object
|
boolean |
isConvertibleTo(java.lang.Class<?> jClass)
Test whether this data object can be converted to the specified
Java data type.
|
boolean |
isVariableLength()
Determines if this instance represents a variable or fixed length
character sequence.
|
long |
longValue()
Convert to a long representation of the datum object
|
int |
oracleId()
The integer that identifies the character set.
|
void |
setVariableLength(boolean variableLength)
Sets a flag to indicate if this instance represents a
fixed or variable length character sequence.
|
java.lang.String |
stringValue()
Convert this data object into a String.
|
java.sql.Timestamp |
timestampValue()
Convert to a Timestamp representation of the datum object
|
java.sql.Time |
timeValue()
Convert to a Time representation of the datum object
|
java.lang.Object |
toJdbc()
Convert this data object into its default Java object type.
|
java.lang.String |
toString()
Converts the characters to a String.
|
bytesEqual, bytesHashCode, compareBytes, getBytes, getLength, getStream, isNull, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timeValue, toClass
public static final CharacterSet DEFAULT_CHARSET
protected CHAR()
public CHAR(java.lang.String str, CharacterSet charSet, int len) throws java.sql.SQLException
str
- the sequence of characters (represented in Unicode).charSet
- the CharacterSet to which the string should be converted.if charSet is null, default charset will be used. The default charset choose we8iso8859p1 as Oracle Utiliites charset.
len
- the length that the CHAR object will be space padded up tojava.sql.SQLException
- if the attempt to convert str to charSet throws
an exception.public CHAR(java.lang.String str, CharacterSet charSet) throws java.sql.SQLException
str
- the sequence of characters (represented in Unicode).charSet
- the CharacterSet to which the string should be converted.if charSet is null, default charset will be used. The default charset choose we8iso8859p1 as Oracle Utiliites charset.
java.sql.SQLException
- if the attempt to convert str to charSet throws
an exception.public CHAR(java.lang.Object obj, CharacterSet charSet) throws java.sql.SQLException
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.java.sql.SQLException
- if the input argument 'obj' is an instance of an
unsupported class, or if the input object cannot be
converted into a CHAR.public int oracleId()
public java.lang.String getString() throws java.sql.SQLException
java.sql.SQLException
- if conversion from this.oracleId to UTF is not
supportedjava.sql.SQLException
- if the particular cannot characters cannot be
converted without loss to Unicode.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object toJdbc() throws java.sql.SQLException
public boolean isConvertibleTo(java.lang.Class<?> jClass)
isConvertibleTo
in class Datum
jClass
- specifies the Java data type to test against.public java.lang.String stringValue()
stringValue
in class Datum
public boolean booleanValue() throws java.sql.SQLException
booleanValue
in class Datum
SQLException,
- if no boolean representation existsjava.sql.SQLException
public int intValue() throws java.sql.SQLException
public long longValue() throws java.sql.SQLException
public float floatValue() throws java.sql.SQLException
floatValue
in class Datum
SQLException,
- if no float representation existsjava.sql.SQLException
public double doubleValue() throws java.sql.SQLException
doubleValue
in class Datum
SQLException,
- if no double representation existsjava.sql.SQLException
public byte byteValue() throws java.sql.SQLException
public java.sql.Date dateValue() throws java.sql.SQLException
public java.sql.Time timeValue() throws java.sql.SQLException
public java.sql.Timestamp timestampValue() throws java.sql.SQLException
timestampValue
in class Datum
SQLException,
- if no Timestamp representation existsjava.sql.SQLException
public java.math.BigDecimal bigDecimalValue() throws java.sql.SQLException
bigDecimalValue
in class Datum
java.sql.SQLException
public java.io.Reader characterStreamValue() throws java.sql.SQLException
characterStreamValue
in class Datum
SQLException,
- if no character stream representation existsjava.sql.SQLException
public java.io.InputStream asciiStreamValue() throws java.sql.SQLException
asciiStreamValue
in class Datum
SQLException,
- if no ascii stream representation existsjava.sql.SQLException
public java.io.InputStream binaryStreamValue() throws java.sql.SQLException
binaryStreamValue
in class Datum
SQLException,
- if no binary stream representation existsjava.sql.SQLException
protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
getConnectionDuringExceptionHandling
in class Datum
public void setVariableLength(boolean variableLength)
variableLength
- True for variable length or false for fixed length.public boolean isVariableLength()