jet.connect
Class DbBinary

java.lang.Object
  extended by jet.connect.DbValue
      extended by jet.connect.DbBinary
All Implemented Interfaces:
jet.util.DbValueable, jet.util.QuickSortableNode
Direct Known Subclasses:
fImage

public class DbBinary
extends DbValue

The DbBinary class wraps an array of primitive type byte in an object. An object of the type DbBinary contains a single field whose type is byte array.

In addition, this class provides several methods for the interconversion of a byte array and a String array, as well as other constants and methods used when dealing with a DbBinary.


Field Summary
 byte[] value
          Deprecated.  
 
Fields inherited from class jet.connect.DbValue
bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC
 
Fields inherited from interface jet.util.DbValueable
EQUAL, GREATER, LESS
 
Constructor Summary
DbBinary()
          Constructs an uninitialized DbBinary.
DbBinary(DbColDesc desc)
          Constructs an uninitialized DbBinary.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this DbBinary object.
 int compareTo(DbValue v)
          Compares this DbBinary object with the DbValue object.
 boolean equals(DbValue v)
          Compares this object to the specified object.
 byte[] get()
          Returns the value of this DbBinary as a byte array value.
 void set(byte[] v)
          Sets a newly allocated DbBinary object that represents the specified byte array argument.
 void set(DbValue v)
          Sets a newly allocated DbBinary object that represents the byte array value indicated by the DbValue parameter.
 void set(JRHierarchicalDataset hds, int col)
          Sets a newly allocated DbBinary object that represents the byte array value indicated by the JRHierarchicalDataset parameter and an index of the column.
 void set(java.sql.ResultSet rs, int col)
          Sets a newly allocated DbBinary object that represents the byte array value indicated by the ResultSet parameter and an index of the column.
 void setValue(java.lang.String v)
          Sets a newly allocated DbBinary object that represents the byte array value indicated by the String parameter.
 java.lang.String toString()
          Returns a String object representing this byte array's value.
 java.lang.String toStringValue()
           
 
Methods inherited from class jet.connect.DbValue
compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, setColDesc, setfoo, setNull, setValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public byte[] value
Deprecated. 
The field contains the value of this object. Note, use get and set to access it instead of accessing it directly.

Constructor Detail

DbBinary

public DbBinary()
Constructs an uninitialized DbBinary. This DbBinary object is mutable until the value and the description of the column are set.


DbBinary

public DbBinary(DbColDesc desc)
Constructs an uninitialized DbBinary. This DbBinary object is mutable until the value is set.

Parameters:
desc - The value to be represented by the DbColDesc object.
Method Detail

get

public byte[] get()
Returns the value of this DbBinary as a byte array value.


set

public void set(byte[] v)
Sets a newly allocated DbBinary object that represents the specified byte array argument.

Parameters:
v - The value to be represented by the DbBinary object.

set

public void set(java.sql.ResultSet rs,
                int col)
         throws java.sql.SQLException
Sets a newly allocated DbBinary object that represents the byte array value indicated by the ResultSet parameter and an index of the column.

Specified by:
set in class DbValue
Parameters:
rs - The ResultSet to be fetched.
col - The index of the column.
Throws:
java.sql.SQLException - if the ResultSet does not contain the index.

set

public void set(JRHierarchicalDataset hds,
                int col)
         throws java.sql.SQLException
Sets a newly allocated DbBinary object that represents the byte array value indicated by the JRHierarchicalDataset parameter and an index of the column.

Overrides:
set in class DbValue
Parameters:
hds - The JRHierarchicalDataset to be fetched.
col - The index of the column.
Throws:
java.sql.SQLException - if the ResultSet does not contain the index.

toString

public java.lang.String toString()
Returns a String object representing this byte array's value. The value is converted from the byte array and returned as a string. If the value is null, it returns "NULL".

Specified by:
toString in class DbValue
Returns:
a string representation of the value of this object.

clone

public java.lang.Object clone()
Creates a clone of this DbBinary object.

Specified by:
clone in interface jet.util.DbValueable
Specified by:
clone in class DbValue

equals

public boolean equals(DbValue v)
Compares this object to the specified object. Note, this method should not be called, since we do not provide binary comparison approach.

Specified by:
equals in class DbValue
Parameters:
v - The DbValue object to be compared with.
Returns:
throw an Error.

compareTo

public int compareTo(DbValue v)
Compares this DbBinary object with the DbValue object.

Specified by:
compareTo in class DbValue
Returns:
throw an Error.
See Also:
DbValueable

set

public void set(DbValue v)
Sets a newly allocated DbBinary object that represents the byte array value indicated by the DbValue parameter. The DbValue object will be checked to see if it is null.

Specified by:
set in class DbValue
Parameters:
v - The DbValue to be converted to a byte array. If it is null, the value will not be set.

setValue

public void setValue(java.lang.String v)
Sets a newly allocated DbBinary object that represents the byte array value indicated by the String parameter.

Specified by:
setValue in class DbValue
Parameters:
v - The String to be converted to a byte array.

toStringValue

public java.lang.String toStringValue()
Specified by:
toStringValue in class DbValue
Returns:
a string which will represent the value in the DbValue(null flag and value). When compare StringValue from DbValues, we always assume that: the two DbValues have same DbColDesc. Two StringValue equals means the original DbValue equals. Does NOT transfer the compareTo(DbValue v) method. Only comparable dbValue implements this methods. String coding uses Base64.