## org.h2.value
Class ValueLob2

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

    public class ValueLob2

extends Value

An alternate LOB implementation.

Field Summary

Fields inherited from class org.h2.value.Value
`ARRAY, BLOB, BOOLEAN, BYTE, BYTES, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, 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` `convertTo(int t)` Convert a lob to another data type.
`ValueLob2` `copyToTemp()` Create an independent copy of this temporary value.
`static ValueLob2` `create(int type, LobStorage lobStorage, java.lang.String fileName, long id, long precision)` Create a LOB value.
`static ValueLob2` `createSmallLob(int type, byte[] small)` Create a small lob using the given byte array.
`static ValueLob2` `createTempBlob(java.io.InputStream in, long length, DataHandler handler)` Create a temporary BLOB value from a stream.
`static ValueLob2` `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` `isFileBased()` Check if this value is stored in it's own file.
`boolean` `isLinked()` Check if this value is linked to a specific table.
`Value` `link(DataHandler h, 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.
`void` `setPrecision(long precision)`
`java.lang.String` `toString()`
`void` `unlink()` Mark any underlying resource as 'not linked to any table'.

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

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

Method Detail

### create

    public static ValueLob2 create(int type,
                                   LobStorage lobStorage,
                                   java.lang.String fileName,
                                   long id,
                                   long precision)

  Create a LOB value.

  Parameters:
    `type` - the type
    `lobStorage` - the storage
    `fileName` - the file name (may be null)
    `id` - the lob id
    `precision` - the precision (number of bytes / characters)
  Returns:
    the value

### createSmallLob

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

  Create a small lob using the given byte array.

  Parameters:
    `type` - the type (Value.BLOB or CLOB)
    `small` - the byte array
  Returns:
    the lob 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

### 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()

  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`

### link

    public Value link(DataHandler h,
                      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:
    `h` - 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

### isFileBased

    public boolean isFileBased()

  Description copied from class: `Value`
  Check if this value is stored in it's own file. For values that are kept fully in memory, this method returns false.

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

### 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 ValueLob2 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()

### setPrecision

    public void setPrecision(long precision)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `Value`

### createTempClob

    public static ValueLob2 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 ValueLob2 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