org.h2.store
Class LobStorageFrontend

java.lang.Object
  extended by org.h2.store.LobStorageFrontend
All Implemented Interfaces:
LobStorageInterface

public class LobStorageFrontend
extends java.lang.Object
implements LobStorageInterface

This class stores LOB objects in the database. This is the front-end i.e. the client side of the LOB storage.


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
LobStorageFrontend(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, byte[] hmac, long byteCount)
          Get the input stream for the given lob.
 void removeLob(long lob)
          Delete a LOB from the database.
 void setTable(long lobId, int tableIdSessionVariable)
          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

LobStorageFrontend

public LobStorageFrontend(DataHandler handler)
Method Detail

removeLob

public void removeLob(long lob)
Delete a LOB from the database.

Specified by:
removeLob in interface LobStorageInterface
Parameters:
lob - the lob id

getInputStream

public java.io.InputStream getInputStream(long lobId,
                                          byte[] hmac,
                                          long byteCount)
                                   throws java.io.IOException
Get the input stream for the given lob.

Specified by:
getInputStream in interface LobStorageInterface
Parameters:
lobId - the lob id
hmac - the message authentication code (for remote input streams)
byteCount - the number of bytes to read, or -1 if not known
Returns:
the stream
Throws:
java.io.IOException

copyLob

public ValueLobDb copyLob(int type,
                          long oldLobId,
                          int tableId,
                          long length)
Description copied from interface: LobStorageInterface
Copy a lob.

Specified by:
copyLob in interface LobStorageInterface
Parameters:
type - the type
oldLobId - the old lob id
tableId - the new table id
length - the length
Returns:
the new lob

setTable

public void setTable(long lobId,
                     int tableIdSessionVariable)
Description copied from interface: LobStorageInterface
Set the table reference of this lob.

Specified by:
setTable in interface LobStorageInterface
Parameters:
lobId - the lob
tableIdSessionVariable - the table

createBlob

public Value createBlob(java.io.InputStream in,
                        long maxLength)
Description copied from interface: LobStorageInterface
Create a BLOB object.

Specified by:
createBlob in interface LobStorageInterface
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.

Specified by:
createClob in interface LobStorageInterface
Parameters:
reader - the reader
maxLength - the maximum length (-1 if not known)
Returns:
the LOB

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