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' to use for session variables.
 
Constructor Summary
LobStorage(java.sql.Connection newConn)
           
 
Method Summary
 long addLob(java.io.InputStream in, long maxLength, int table)
          Store the LOB in the database.
static ValueLob createBlob(java.io.InputStream in, long maxLength, DataHandler handler)
          Create a BLOB object.
static ValueLob createClob(java.io.Reader reader, long maxLength, DataHandler handler)
          Create a CLOB object.
static ValueLob createSmallLob(int type, byte[] small)
          Create a LOB object that fits in memory.
static void removeAllForTable(DataHandler handler, int tableId)
          Remove all LOBs for this table.
 
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' to use for session variables.

See Also:
Constant Field Values
Constructor Detail

LobStorage

public LobStorage(java.sql.Connection newConn)
Method Detail

removeAllForTable

public static void removeAllForTable(DataHandler handler,
                                     int tableId)
Remove all LOBs for this table.

Parameters:
handler - the data handler
tableId - the table id

createSmallLob

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

createBlob

public static ValueLob createBlob(java.io.InputStream in,
                                  long maxLength,
                                  DataHandler handler)
Create a BLOB object.

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

createClob

public static ValueLob createClob(java.io.Reader reader,
                                  long maxLength,
                                  DataHandler handler)
Create a CLOB object.

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

addLob

public long addLob(java.io.InputStream in,
                   long maxLength,
                   int table)
Store the LOB in the database.

Parameters:
in - the input stream
maxLength - the maximum length (-1 for unknown)
table - the table
Returns:
the LOB id