Top Description Fields Constructors Methods
org.h2.value

public abstract Class ValueLob

extends Value
Class Inheritance
Known Direct Subclasses
org.h2.value.ValueBlob, org.h2.value.ValueClob
Imports
java.io.IOException, .InputStream, .Reader, org.h2.engine.Constants, .SysProperties, org.h2.message.DbException, org.h2.store.DataHandler, .LobStorageFrontend, .LobStorageInterface, .RangeInputStream, .RangeReader, org.h2.store.fs.FileUtils, org.h2.util.IOUtils, .MathUtils, .StringUtils, .Utils, org.h2.value.lob.LobData, .LobDataDatabase, .LobDataFetchOnDemand, .LobDataInMemory

A implementation of the BINARY LARGE OBJECT and CHARACTER LARGE OBJECT 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.

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv long
charLength

Length in characters.

private int
hash

Cache the hashCode because it can be expensive to compute.

pack-priv final LobData
pack-priv long
octetLength

Length in bytes.

private TypeInfo
Inherited from org.h2.value.Value:
ARRAYASSIGN_TOBIGINTBINARYBLOBBOOLEANCAST_TOCHARCLOBCONVERT_TODATEDECFLOATDOUBLEEMPTY_VALUESENUMGEOMETRYGROUP_BINARY_STRINGGROUP_BOOLEANGROUP_CHARACTER_STRINGGROUP_COLLECTIONGROUP_DATETIMEGROUP_INTERVAL_DTGROUP_INTERVAL_YMGROUP_NULLGROUP_NUMERICGROUP_OTHERGROUPSINTEGERINTERVAL_DAYINTERVAL_DAY_TO_HOURINTERVAL_DAY_TO_MINUTEINTERVAL_DAY_TO_SECONDINTERVAL_HOURINTERVAL_HOUR_TO_MINUTEINTERVAL_HOUR_TO_SECONDINTERVAL_MINUTEINTERVAL_MINUTE_TO_SECONDINTERVAL_MONTHINTERVAL_SECONDINTERVAL_YEARINTERVAL_YEAR_TO_MONTHJAVA_OBJECTJSONMAX_LONG_DECIMALMIN_LONG_DECIMALNULLNUMERICREALROWSMALLINTTIMETIME_TZTIMESTAMPTIMESTAMP_TZTINYINTTYPE_COUNTUNKNOWNUUIDVARBINARYVARCHARVARCHAR_IGNORECASE

Constructor Summary

AccessConstructor and Description
pack-priv
ValueLob(LobData lobData, long octetLength, long charLength)

Method Summary

Modifier and TypeMethod and Description
public abstract ValueLob

Returns:

the new value or itself
copy
(DataHandler
the data handler
database
,
int
the table where this object is used
tableId
)

Copy a large value, to be used in the given table.

public ValueLob

Returns:

the value (this for small objects)
copyToResult
()

Create an independent copy of this value, that will be bound to a result.

pack-priv static String

Returns:

full path and name of the created file
createTempLobFileName
(DataHandler
to get path from
handler
)

Create file name for temporary LOB storage

public boolean
equals(Object
the other value
other
)

Implements abstract org.h2.value.Value.equals.

Check if the two values have the same hash code.

pack-priv final void
pack-priv DbException
getBinaryTooLong(long precision)

pack-priv static int
getBufferSize(DataHandler handler, long remaining)

public byte[]
pack-priv abstract byte[]
public byte[]
public LobData
public int
getMemory()

Overrides org.h2.value.Value.getMemory.

Get the memory used by this object.

public Reader
private byte[]
pack-priv DbException
getStringTooLong(long precision)

public TypeInfo
getType()

Implements abstract org.h2.value.Value.getType.

Implements org.h2.value.Typed.getType.

Returns the data type.

public int
hashCode()

Implements abstract org.h2.value.Value.hashCode.

Returns a hash code value for this object.

public boolean

Returns:

true if it is
isLinkedToTable
()

Check if this value is linked to a specific table.

private static void
rangeCheckUnknown(long zeroBasedOffset, long length)

protected static InputStream

Returns:

the smaller input stream
rangeInputStream
(InputStream
the source input stream
inputStream
,
long
the offset (1 means no offset)
oneBasedOffset
,
long
the length of the result, in bytes
length
,
long
the length of the input, in bytes
dataSize
)

Create an input stream that is s subset of the given stream.

pack-priv static Reader

Returns:

the smaller input stream
rangeReader
(Reader
the input reader
reader
,
long
the offset (1 means no offset)
oneBasedOffset
,
long
the length of the result, in bytes
length
,
long
the length of the input, in bytes
dataSize
)

Create a reader that is s subset of the given reader.

pack-priv byte[]
readBytes(int len)

pack-priv String
readString(int len)

public void
remove()

Remove the underlying resource, if any.

Inherited from org.h2.value.Value:
addcachecastTocharLengthclearCachecompareTocompareTypeSafecompareWithNullcontainsNullconvertForAssignToconvertToconvertToconvertToconvertToconvertToconvertToAnyArrayconvertToAnyJsonconvertToAnyRowconvertToBigintconvertToBooleanconvertToCharconvertToDateconvertToDoubleconvertToEnumconvertToGeometryconvertToIntconvertToIntconvertToJavaObjectconvertToJsonconvertToLongconvertToRealconvertToSmallintconvertToTinyintconvertToUuiddividegetBigDecimalgetBooleangetBytegetDataConversionErrorgetDataConversionErrorgetDoublegetFloatgetHigherOrdergetHigherOrderKnowngetInputStreamgetInputStreamgetIntgetLonggetReadergetShortgetSignumgetStringgetTypeNamegetUnsupportedExceptionForOperationgetValueTooLongExceptiongetValueTypegetValueWithFirstNullgetValueWithFirstNullImplisFalseisTruemodulusmultiplynegateoctetLengthrangeChecksubtracttoString

Field Detail

BLOCK_COMPARISON_SIZEback to summary
pack-priv static final int BLOCK_COMPARISON_SIZE
charLengthback to summary
pack-priv long charLength

Length in characters.

hashback to summary
private int hash

Cache the hashCode because it can be expensive to compute.

lobDataback to summary
pack-priv final LobData lobData
octetLengthback to summary
pack-priv long octetLength

Length in bytes.

typeback to summary
private TypeInfo type

Constructor Detail

ValueLobback to summary
pack-priv ValueLob(LobData lobData, long octetLength, long charLength)

Method Detail

copyback to summary
public abstract ValueLob copy(DataHandler database, int tableId)

Copy a large value, to be used in the given table. For values that are kept fully in memory this method has no effect.

Parameters
database:DataHandler

the data handler

tableId:int

the table where this object is used

Returns:ValueLob

the new value or itself

copyToResultback to summary
public ValueLob copyToResult()

Create an independent copy of this value, that will be bound to a result.

Returns:ValueLob

the value (this for small objects)

createTempLobFileNameback to summary
pack-priv static String createTempLobFileName(DataHandler handler) throws IOException

Create file name for temporary LOB storage

Parameters
handler:DataHandler

to get path from

Returns:String

full path and name of the created file

Exceptions
IOException:
if file creation fails
equalsback to summary
public boolean equals(Object other)

Implements abstract org.h2.value.Value.equals.

Doc from org.h2.value.Value.equals.

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.

Parameters
other:Object

the other value

Returns:boolean

true if they are equal

Annotations
@Override
formatLobDataCommentback to summary
pack-priv final void formatLobDataComment(StringBuilder builder)
getBinaryTooLongback to summary
pack-priv DbException getBinaryTooLong(long precision)
getBufferSizeback to summary
pack-priv static int getBufferSize(DataHandler handler, long remaining)
getBytesback to summary
public byte[] getBytes()

Overrides org.h2.value.Value.getBytes.

Annotations
@Override
getBytesInternalback to summary
pack-priv abstract byte[] getBytesInternal()
getBytesNoCopyback to summary
public byte[] getBytesNoCopy()

Overrides org.h2.value.Value.getBytesNoCopy.

Annotations
@Override
getLobDataback to summary
public LobData getLobData()
getMemoryback to summary
public int getMemory()

Overrides org.h2.value.Value.getMemory.

Doc from org.h2.value.Value.getMemory.

Get the memory used by this object.

Returns:int

the memory used in bytes

Annotations
@Override
getReaderback to summary
public Reader getReader()

Overrides org.h2.value.Value.getReader.

Annotations
@Override
getSmallback to summary
private byte[] getSmall()
getStringTooLongback to summary
pack-priv DbException getStringTooLong(long precision)
getTypeback to summary
public TypeInfo getType()

Implements abstract org.h2.value.Value.getType.

Implements org.h2.value.Typed.getType.

Doc from org.h2.value.Typed.getType.

Returns the data type.

Returns:TypeInfo

the data type

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract org.h2.value.Value.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isLinkedToTableback to summary
public boolean isLinkedToTable()

Check if this value is linked to a specific table. For values that are kept fully in memory, this method returns false.

Returns:boolean

true if it is

rangeCheckUnknownback to summary
private static void rangeCheckUnknown(long zeroBasedOffset, long length)
rangeInputStreamback to summary
protected static InputStream rangeInputStream(InputStream inputStream, long oneBasedOffset, long length, long dataSize)

Create an input stream that is s subset of the given stream.

Parameters
inputStream:InputStream

the source input stream

oneBasedOffset:long

the offset (1 means no offset)

length:long

the length of the result, in bytes

dataSize:long

the length of the input, in bytes

Returns:InputStream

the smaller input stream

rangeReaderback to summary
pack-priv static Reader rangeReader(Reader reader, long oneBasedOffset, long length, long dataSize)

Create a reader that is s subset of the given reader.

Parameters
reader:Reader

the input reader

oneBasedOffset:long

the offset (1 means no offset)

length:long

the length of the result, in bytes

dataSize:long

the length of the input, in bytes

Returns:Reader

the smaller input stream

readBytesback to summary
pack-priv byte[] readBytes(int len)
readStringback to summary
pack-priv String readString(int len)
removeback to summary
public void remove()

Remove the underlying resource, if any. For values that are kept fully in memory this method has no effect.