Oracle JDBC API Reference
11g Release 2 ("11.2.0.3.0")

oracle.sql
Class RAW

java.lang.Object
  extended by oracle.sql.Datum
      extended by oracle.sql.RAW
All Implemented Interfaces:
java.io.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
static java.lang.String BUILD_DATE
           
static boolean TRACE
           
 
Constructor Summary
RAW(byte[] raw_bytes)
          Construct a RAW from a byte array.
RAW(java.lang.Object val)
          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.
 
Method Summary
static byte[] hexString2Bytes(java.lang.String hexString)
          Converts a String of hex digits into a byte array with the corresponding byte values.
 boolean isConvertibleTo(java.lang.Class jClass)
          Test whether this data object can be converted to the specified Java data type.
static RAW newRAW(java.lang.Object obj)
          Creates a new RAW from an Object in the manner of the RAW(Object) constructor beginning in 10i R1.
static RAW oldRAW(java.lang.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.
 java.lang.String stringValue()
          Convert this data object into a String.
 java.lang.Object toJdbc()
          Convert this data object into its default Java object type.
 
Methods inherited from class oracle.sql.Datum
bigDecimalValue, booleanValue, byteValue, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, longValue, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timestampValue, timeValue, timeValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUILD_DATE

public static final java.lang.String BUILD_DATE
See Also:
Constant Field Values

TRACE

public static final boolean TRACE
See Also:
Constant Field Values
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(java.lang.Object val)
    throws java.sql.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:
java.sql.SQLException
See Also:
#newRAW(Object), #oldRAW(Object)
Method Detail

hexString2Bytes

public static byte[] hexString2Bytes(java.lang.String hexString)
                              throws java.sql.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:
java.sql.SQLException - if one of the characters in the argument is not a hex digit

newRAW

public static RAW newRAW(java.lang.Object obj)
                  throws java.sql.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:
java.sql.SQLException - if the argument is a String and one of the characters is not a hex digit
See Also:
oldRAW

oldRAW

public static RAW oldRAW(java.lang.Object obj)
                  throws java.sql.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:
java.sql.SQLException - if something goes wrong
See Also:
newRAW

toJdbc

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

Specified by:
toJdbc in class Datum
Returns:
the data value as a byte array.
Throws:
java.sql.SQLException - if any of the lower layer code throws an exception.

isConvertibleTo

public boolean isConvertibleTo(java.lang.Class jClass)
Test whether this data object can be converted to the specified Java data type.

Specified by:
isConvertibleTo in class Datum
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 java.lang.String stringValue()
Convert this data object into a String.

Overrides:
stringValue in class Datum
Returns:
the data value in String representation.

Oracle JDBC API Reference
11g Release 2 ("11.2.0.3.0")

Copyright © 1998, 2007, Oracle. All rights reserved.