org.h2.store
Class LobStorageMap

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

public class LobStorageMap
extends java.lang.Object
implements LobStorageInterface

This class stores LOB objects in the database, in maps. This is the back-end i.e. the server side of the LOB storage.


Constructor Summary
LobStorageMap(Database database)
           
 
Method Summary
 ValueLobDb copyLob(ValueLobDb old, 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.
 java.io.InputStream getInputStream(ValueLobDb lob, byte[] hmac, long byteCount)
          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 removeLob(ValueLobDb lob)
          Delete a LOB (from the database, if it is stored there).
 void setTable(ValueLobDb lob, int tableId)
          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
 

Constructor Detail

LobStorageMap

public LobStorageMap(Database database)
Method Detail

init

public void init()
Description copied from interface: LobStorageInterface
Initialize the lob storage.

Specified by:
init in interface LobStorageInterface

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)
Description copied from interface: LobStorageInterface
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

copyLob

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

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

getInputStream

public java.io.InputStream getInputStream(ValueLobDb lob,
                                          byte[] hmac,
                                          long byteCount)
                                   throws java.io.IOException
Description copied from interface: LobStorageInterface
Get the input stream for the given lob.

Specified by:
getInputStream in interface LobStorageInterface
Parameters:
lob - 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

setTable

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

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

removeAllForTable

public void removeAllForTable(int tableId)
Description copied from interface: LobStorageInterface
Remove all LOBs for this table.

Specified by:
removeAllForTable in interface LobStorageInterface
Parameters:
tableId - the table id

removeLob

public void removeLob(ValueLobDb lob)
Description copied from interface: LobStorageInterface
Delete a LOB (from the database, if it is stored there).

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