Package oracle.sql
Class RAW
- java.lang.Object
-
- oracle.sql.Datum
-
- oracle.sql.RAW
-
- All Implemented Interfaces:
Serializable
public class RAW extends Datum
The RAW class is a representation of the Oracle RAW datatype. It is intended to be immutable. The user should not try to change its contents once it is constructed.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class oracle.sql.Datum
ojiOracleDatumWithConnection, targetDatum
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected oracle.jdbc.internal.OracleConnection
getConnectionDuringExceptionHandling()
static byte[]
hexString2Bytes(String hexString)
Converts a String of hex digits into a byte array with the corresponding byte values.boolean
isConvertibleTo(Class<?> jClass)
Test whether this data object can be converted to the specified Java data type.static RAW
newRAW(Object obj)
Creates a new RAW from an Object in the manner of the RAW(Object) constructor beginning in 10i R1.static RAW
oldRAW(Object obj)
Creates a new RAW from an Object in the manner of the RAW(Object) constructor in versions of Oracle JDBC 9.2 and earlier.String
stringValue()
Convert this data object into a String.Object
toJdbc()
Convert this data object into its default Java object type.-
Methods inherited from class oracle.sql.Datum
bigDecimalValue, booleanValue, bytesEqual, bytesHashCode, byteValue, compareBytes, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, isNull, longValue, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timestampValue, timeValue, timeValue, toClass
-
-
-
-
Constructor Detail
-
RAW
public RAW(byte[] raw_bytes)
Construct a RAW from a byte array.- Parameters:
raw_bytes
- input data from which this class instance is constructed.
-
RAW
public RAW(Object val) throws SQLException
Deprecated.in 9.2. The behavior of this constructor when passed a String argument will be changed in the next major release after 9.2. There will be no change in the behavior when passed an argument of any other type. The static methods newRAW and oldRAW capture the new and old behavior. It is deprecated only to warn of the impending change in behavior. The deprecation will be removed in the next major release after 9.2. The constructor will remain and will be supported. See release notes for more info.Construct a RAW from a Java object. The possible object types are java.lang.String and byte[].- Parameters:
val
- input data from which this class instance is constructed.- Throws:
SQLException
-
-
Method Detail
-
hexString2Bytes
public static byte[] hexString2Bytes(String hexString) throws SQLException
Converts a String of hex digits into a byte array with the corresponding byte values.- Parameters:
hexString
- A String of hex digits- Returns:
- a byte array half the length of the argument with the value corresponding to the argument
- Throws:
SQLException
- if one of the characters in the argument is not a hex digit
-
newRAW
public static RAW newRAW(Object obj) throws SQLException
Creates a new RAW from an Object in the manner of the RAW(Object) constructor beginning in 10i R1. The only difference is if the argument is a String. This method assumes that the String consists of hex digits and returns a new RAW constructed from the bytes represented by those hex digits. If the argument is not a String then the behavior is the same as the RAW(Object) constructor.In Oracle JDBC versions beginning in 10i R1 this is identical to RAW(Object). In versions 9.2 and earlier, it provides the functionality that will be provided in versions beginning in 10i R1.
Note that the behavior of RAW(Object) when passed a String argument changed in 10i R1.
- Parameters:
obj
- Object used to create the new RAW value- Returns:
- a new RAW value
- Throws:
SQLException
- if the argument is a String and one of the characters is not a hex digit- See Also:
oldRAW(java.lang.Object)
-
oldRAW
public static RAW oldRAW(Object obj) throws SQLException
Creates a new RAW from an Object in the manner of the RAW(Object) constructor in versions of Oracle JDBC 9.2 and earlier. The only difference is if the argument is a String. This method returns a new RAW containing the bytes of the ISO8859_1 representation of the String argument. If the argument is not a String then it is the same as the RAW(Object) constructor.In Oracle JDBC versions 9.2 and earlier this is identical to the RAW(Object) constructor. Beginning in 10i R1, it provides the functionality that previously was provided by that constructor.
Note that the behavior of RAW(Object) when passed a String argument changed in 10i R1.
- Parameters:
obj
- Object used to create the RAW value- Returns:
- a new RAW value
- Throws:
SQLException
- if something goes wrong- See Also:
newRAW(java.lang.Object)
-
toJdbc
public Object toJdbc() throws SQLException
Convert this data object into its default Java object type.- Specified by:
toJdbc
in classDatum
- Returns:
- the data value as a byte array.
- Throws:
SQLException
- if any of the lower layer code throws an exception.
-
isConvertibleTo
public boolean isConvertibleTo(Class<?> jClass)
Test whether this data object can be converted to the specified Java data type.- Specified by:
isConvertibleTo
in classDatum
- 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.
-
stringValue
public String stringValue()
Convert this data object into a String.- Overrides:
stringValue
in classDatum
- Returns:
- the data value in String representation.
-
getConnectionDuringExceptionHandling
protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
- Overrides:
getConnectionDuringExceptionHandling
in classDatum
-
-