org.h2.store
Class LobStorage

java.lang.Object
  extended by org.h2.store.LobStorage

public class LobStorage
extends java.lang.Object

This class stores LOB objects in the database.


Nested Class Summary
static class LobStorage.LobInputStream
          An input stream that reads from a LOB.
 
Field Summary
static int TABLE_ID_SESSION_VARIABLE
          The table id for session variables (LOBs not assigned to a table).
static int TABLE_TEMP
          The table id for temporary objects (not assigned to any object).
 
Constructor Summary
LobStorage(DataHandler handler)
           
 
Method Summary
 ValueLobDb copyLob(int type, long oldLobId, int tableId, long length)
          Copy a lob.
 Value createBlob(java.io.InputStream in, long maxLength)
          Create a BLOB object.
 Value createClob(java.io.Reader reader, long maxLength)
          Create a CLOB object.
static Value createSmallLob(int type, byte[] small)
          Create a LOB object that fits in memory.
 java.io.InputStream getInputStream(long lobId)
          Get the input stream for the given lob.
 void init()
          Initialize the lob storage.
 void removeAllForTable(int tableId)
          Remove all LOBs for this table.
 void setTable(long lobId, int table)
          Set the table reference of this lob.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_ID_SESSION_VARIABLE

public static final int TABLE_ID_SESSION_VARIABLE
The table id for session variables (LOBs not assigned to a table).

See Also:
Constant Field Values

TABLE_TEMP

public static final int TABLE_TEMP
The table id for temporary objects (not assigned to any object).

See Also:
Constant Field Values
Constructor Detail

LobStorage

public LobStorage(DataHandler handler)
Method Detail

init

public void init()
Initialize the lob storage.


removeAllForTable

public void removeAllForTable(int tableId)
Remove all LOBs for this table.

Parameters:
tableId - the table id

createSmallLob

public static Value createSmallLob(int type,
                                   byte[] small)
Create a LOB object that fits in memory.

Parameters:
type - the value type
small - the byte array
Returns:
the LOB

getInputStream

public java.io.InputStream getInputStream(long lobId)
                                   throws java.io.IOException
Get the input stream for the given lob.

Parameters:
lobId - the lob id
Returns:
the stream
Throws:
java.io.IOException

copyLob

public ValueLobDb copyLob(int type,
                          long oldLobId,
                          int tableId,
                          long length)
Copy a lob.

Parameters:
type - the type
oldLobId - the old lob id
tableId - the new table id
length - the length
Returns:
the new lob

createBlob

public Value createBlob(java.io.InputStream in,
                        long maxLength)
Create a BLOB object.

Parameters:
in - the input stream
maxLength - the maximum length (-1 if not known)
Returns:
the LOB

createClob

public Value createClob(java.io.Reader reader,
                        long maxLength)
Create a CLOB object.

Parameters:
reader - the reader
maxLength - the maximum length (-1 if not known)
Returns:
the LOB

setTable

public void setTable(long lobId,
                     int table)
Set the table reference of this lob.

Parameters:
lobId - the lob
table - the table