## org.h2.value
Class ValueLobDb

    java.lang.Object
      org.h2.value.Value
          org.h2.value.ValueLobDb

All Implemented Interfaces:
  Value.ValueBlob, Value.ValueClob

    public class ValueLobDb

extends Value
implements Value.ValueClob, Value.ValueBlob

A implementation of the BLOB and CLOB data types. Small objects are kept in memory and stored in the record. Large objects are either stored in the database, or in temporary files.

Nested Class Summary

Nested classes/interfaces inherited from class org.h2.value.Value
`Value.ValueBlob, Value.ValueClob`

Field Summary

Fields inherited from class org.h2.value.Value
`ARRAY, BLOB, BOOLEAN, BYTE, BYTES, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, GEOMETRY, INT, JAVA_OBJECT, LONG, NULL, RESULT_SET, SHORT, STRING, STRING_FIXED, STRING_IGNORECASE, TIME, TIMESTAMP, TYPE_COUNT, UNKNOWN, UUID`

Method Summary
`void` `close()` Close the underlying resource, if any.
`protected int` `compareSecure(Value v, CompareMode mode)` Compare the value with another value of the same type.
`Value` `convertPrecision(long precision, boolean force)` Convert the precision to the requested value.
`Value` `convertTo(int t)` Convert a lob to another data type.
`ValueLobDb` `copyToTemp()` Create an independent copy of this temporary value.
`static ValueLobDb` `create(int type, DataHandler handler, int tableId, long id, byte[] hmac, long precision)` Create a LOB value.
`static Value` `createSmallLob(int type, byte[] small)` Create a LOB object that fits in memory.
`static ValueLobDb` `createSmallLob(int type, byte[] small, long precision)` Create a LOB object that fits in memory.
`static ValueLobDb` `createTempBlob(java.io.InputStream in, long length, DataHandler handler)` Create a temporary BLOB value from a stream.
`static ValueLobDb` `createTempClob(java.io.Reader in, long length, DataHandler handler)` Create a temporary CLOB value from a stream.
`boolean` `equals(java.lang.Object other)` Check if the two values have the same hash code.
`byte[]` `getBytes()`
`byte[]` `getBytesNoCopy()`
`int` `getDisplaySize()` Get the display size in characters.
`java.io.InputStream` `getInputStream()`
`long` `getLobId()`
`int` `getMemory()` Get the memory used by this object.
`java.lang.Object` `getObject()` Get the value as an object.
`long` `getPrecision()` Get the precision.
`java.io.Reader` `getReader()`
`byte[]` `getSmall()` Get the data if this a small lob value.
`java.lang.String` `getSQL()` Get the SQL expression for this value.
`java.lang.String` `getString()` Get the value as a string.
`int` `getTableId()` Get the current table id of this lob.
`java.lang.String` `getTraceSQL()` Get a medium size SQL expression for debugging or tracing.
`int` `getType()` Get the value type.
`int` `hashCode()`
`boolean` `isLinked()` Check if this value is linked to a specific table.
`boolean` `isStored()`
`Value` `link(DataHandler database, int tabId)` Link a large value to a given table.
`void` `set(java.sql.PreparedStatement prep, int parameterIndex)` Set the value as a parameter in a prepared statement.
`java.lang.String` `toString()`
`void` `unlink(DataHandler database)` Mark any underlying resource as 'not linked to any table'.

Methods inherited from class org.h2.value.Value
`add, checkPrecision, clearCache, compareTo, compareTypeSave, convertScale, divide, getBigDecimal, getBoolean, getByte, getDataHandler, getDate, getDouble, getFloat, getHigherOrder, getInt, getLong, getResultSet, getScale, getShort, getSignum, getTime, getTimestamp, modulus, multiply, negate, subtract, throwUnsupportedExceptionForType`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### create

    public static ValueLobDb create(int type,
                                    DataHandler handler,
                                    int tableId,
                                    long id,
                                    byte[] hmac,
                                    long precision)

  Create a LOB value.

  Parameters:
    `type` - the type
    `handler` - the data handler
    `tableId` - the table id
    `id` - the lob id
    `hmac` - the message authentication code
    `precision` - the precision (number of bytes / characters)
  Returns:
    the value

### convertTo

    public Value convertTo(int t)

  Convert a lob to another data type. The data is fully read in memory except when converting to BLOB or CLOB.

  Overrides:
    `convertTo` in class `Value`
  Parameters:
    `t` - the new type
  Returns:
    the converted value

### isLinked

    public boolean isLinked()

  Description copied from class: `Value`
  Check if this value is linked to a specific table. For values that are kept fully in memory, this method returns false.

  Overrides:
    `isLinked` in class `Value`
  Returns:
    true if it is

### isStored

    public boolean isStored()

### close

    public void close()

  Description copied from class: `Value`
  Close the underlying resource, if any. For values that are kept fully in memory this method has no effect.

  Overrides:
    `close` in class `Value`

### unlink

    public void unlink(DataHandler database)

  Description copied from class: `Value`
  Mark any underlying resource as 'not linked to any table'. For values that are kept fully in memory this method has no effect.

  Overrides:
    `unlink` in class `Value`
  Parameters:
    `database` - the data handler

### link

    public Value link(DataHandler database,
                      int tabId)

  Description copied from class: `Value`
  Link a large value to a given table. For values that are kept fully in memory this method has no effect.

  Overrides:
    `link` in class `Value`
  Parameters:
    `database` - the data handler
    `tabId` - the table to link to
  Returns:
    the new value or itself

### getTableId

    public int getTableId()

  Get the current table id of this lob.

  Overrides:
    `getTableId` in class `Value`
  Returns:
    the table id

### getType

    public int getType()

  Description copied from class: `Value`
  Get the value type.

  Specified by:
    `getType` in class `Value`
  Returns:
    the type

### getPrecision

    public long getPrecision()

  Description copied from class: `Value`
  Get the precision.

  Specified by:
    `getPrecision` in class `Value`
  Returns:
    the precision

### getString

    public java.lang.String getString()

  Description copied from class: `Value`
  Get the value as a string.

  Specified by:
    `getString` in class `Value`
  Returns:
    the string

### getBytes

    public byte[] getBytes()

  Overrides:
    `getBytes` in class `Value`

### getBytesNoCopy

    public byte[] getBytesNoCopy()

  Overrides:
    `getBytesNoCopy` in class `Value`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in class `Value`

### compareSecure

    protected int compareSecure(Value v,
                                CompareMode mode)

  Description copied from class: `Value`
  Compare the value with another value of the same type.

  Specified by:
    `compareSecure` in class `Value`
  Parameters:
    `v` - the other value
    `mode` - the compare mode
  Returns:
    0 if both values are equal, -1 if the other value is smaller, and 1 otherwise

### getObject

    public java.lang.Object getObject()

  Description copied from class: `Value`
  Get the value as an object.

  Specified by:
    `getObject` in class `Value`
  Returns:
    the object

### getReader

    public java.io.Reader getReader()

  Overrides:
    `getReader` in class `Value`

### getInputStream

    public java.io.InputStream getInputStream()

  Overrides:
    `getInputStream` in class `Value`

### set

    public void set(java.sql.PreparedStatement prep,
                    int parameterIndex)
             throws java.sql.SQLException

  Description copied from class: `Value`
  Set the value as a parameter in a prepared statement.

  Specified by:
    `set` in class `Value`
  Parameters:
    `prep` - the prepared statement
    `parameterIndex` - the parameter index
  Throws:
    `java.sql.SQLException`

### getSQL

    public java.lang.String getSQL()

  Description copied from class: `Value`
  Get the SQL expression for this value.

  Specified by:
    `getSQL` in class `Value`
  Returns:
    the SQL expression

### getTraceSQL

    public java.lang.String getTraceSQL()

  Description copied from class: `Value`
  Get a medium size SQL expression for debugging or tracing. If the precision is too large, only a subset of the value is returned.

  Overrides:
    `getTraceSQL` in class `Value`
  Returns:
    the SQL expression

### getSmall

    public byte[] getSmall()

  Get the data if this a small lob value.

  Overrides:
    `getSmall` in class `Value`
  Returns:
    the data

### getDisplaySize

    public int getDisplaySize()

  Description copied from class: `Value`
  Get the display size in characters.

  Specified by:
    `getDisplaySize` in class `Value`
  Returns:
    the display size

### equals

    public boolean equals(java.lang.Object other)

  Description copied from class: `Value`
  Check if the two values have the same hash code. No data conversion is made; this method returns false if the other object is not of the same class. For some values, compareTo may return 0 even if equals return false. Example: ValueDecimal 0.0 and 0.00.

  Specified by:
    `equals` in class `Value`
  Parameters:
    `other` - the other value
  Returns:
    true if they are equal

### getMemory

    public int getMemory()

  Description copied from class: `Value`
  Get the memory used by this object.

  Overrides:
    `getMemory` in class `Value`
  Returns:
    the memory used in bytes

### copyToTemp

    public ValueLobDb copyToTemp()

  Create an independent copy of this temporary value. The file will not be deleted automatically.

  Overrides:
    `copyToTemp` in class `Value`
  Returns:
    the value

### getLobId

    public long getLobId()

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `Value`

### createTempClob

    public static ValueLobDb createTempClob(java.io.Reader in,
                                            long length,
                                            DataHandler handler)

  Create a temporary CLOB value from a stream.

  Parameters:
    `in` - the reader
    `length` - the number of characters to read, or -1 for no limit
    `handler` - the data handler
  Returns:
    the lob value

### createTempBlob

    public static ValueLobDb createTempBlob(java.io.InputStream in,
                                            long length,
                                            DataHandler handler)

  Create a temporary BLOB value from a stream.

  Parameters:
    `in` - the input stream
    `length` - the number of characters to read, or -1 for no limit
    `handler` - the data handler
  Returns:
    the lob value

### convertPrecision

    public Value convertPrecision(long precision,
                                  boolean force)

  Description copied from class: `Value`
  Convert the precision to the requested value. The precision of the returned value may be somewhat larger than requested, because values with a fixed precision are not truncated.

  Overrides:
    `convertPrecision` in class `Value`
  Parameters:
    `precision` - the new precision
    `force` - true if losing numeric precision is allowed
  Returns:
    the new value

### createSmallLob

    public static Value createSmallLob(int type,
                                       byte[] small)

  Create a LOB object that fits in memory.

  Parameters:
    `type` - the type (Value.BLOB or CLOB)
    `small` - the byte array
  Returns:
    the LOB

### createSmallLob

    public static ValueLobDb createSmallLob(int type,
                                            byte[] small,
                                            long precision)

  Create a LOB object that fits in memory.

  Parameters:
    `type` - the type (Value.BLOB or CLOB)
    `small` - the byte array
    `precision` - the precision
  Returns:
    the LOB