org.h2.mvstore.db

## Class LobStorageMap

- java.lang.Object
- - org.h2.mvstore.db.LobStorageMap

All Implemented Interfaces:
  MVStore.Cleaner, LobStorageInterface

    public final class LobStorageMap
    extends java.lang.Object
    implements LobStorageInterface, MVStore.Cleaner

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

### Nested Class Summary

Nested Classes
`static class` `LobStorageMap.BlobMeta`
`static class` `LobStorageMap.BlobReference`

### Constructor Summary

Constructors
Constructor and Description
`LobStorageMap(Database database)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `cleanup(long oldestVersionToKeep)` Actual procedure for cleanup after some unused store versions were dropped
`ValueLob` `copyLob(ValueLob old, int tableId)` Copy a lob.
`ValueBlob` `createBlob(java.io.InputStream in, long maxLength)` Create a BLOB object.
`ValueClob` `createClob(java.io.Reader reader, long maxLength)` Create a CLOB object.
`void` `doRemoveLob(int tableId, long lobId)`
`java.io.InputStream` `getInputStream(long lobId, int tableId, long byteCount)` Get the input stream for the given lob
`java.io.InputStream` `getInputStream(long lobId, long byteCount)` Get the input stream for the given lob, only called on server side of a TCP connection.
`boolean` `isReadOnly()` Whether the storage is read-only
`boolean` `needCleanup()` Determine if cleanup is needed.
`static MVMap<java.lang.Long,byte[]>` `openLobDataMap(TransactionStore txStore)` Open map used to store LOB data
`static MVMap<java.lang.Long,LobStorageMap.BlobMeta>` `openLobMap(TransactionStore txStore)` Open map used to store LOB metadata
`void` `removeAllForTable(int tableId)` Remove all LOBs for this table.
`void` `removeLob(ValueLob lob)` Delete a LOB (from the database, if it is stored there).

### 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

#### openLobMap

    public static MVMap<java.lang.Long,LobStorageMap.BlobMeta> openLobMap(TransactionStore txStore)

Open map used to store LOB metadata

Parameters:
  `txStore` - containing map
Returns:
  MVMap instance

#### openLobDataMap

    public static MVMap<java.lang.Long,byte[]> openLobDataMap(TransactionStore txStore)

Open map used to store LOB data

Parameters:
  `txStore` - containing map
Returns:
  MVMap instance

#### createBlob

    public ValueBlob 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 ValueClob 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

#### isReadOnly

    public boolean isReadOnly()

Description copied from interface: `LobStorageInterface`
Whether the storage is read-only

Specified by:
  `isReadOnly` in interface `LobStorageInterface`
Returns:
  true if yes

#### copyLob

    public ValueLob copyLob(ValueLob old,
                            int tableId)

Description copied from interface: `LobStorageInterface`
Copy a lob.

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

#### getInputStream

    public java.io.InputStream getInputStream(long lobId,
                                              long byteCount)
                                       throws java.io.IOException

Description copied from interface: `LobStorageInterface`
Get the input stream for the given lob, only called on server side of a TCP connection.

Specified by:
  `getInputStream` in interface `LobStorageInterface`
Parameters:
  `lobId` - the lob id
  `byteCount` - the number of bytes to read, or -1 if not known
Returns:
  the stream
Throws:
  `java.io.IOException` - on failure

#### getInputStream

    public java.io.InputStream getInputStream(long lobId,
                                              int tableId,
                                              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:
  `lobId` - the lob id
  `tableId` - the able id
  `byteCount` - the number of bytes to read, or -1 if not known
Returns:
  the stream
Throws:
  `java.io.IOException` - on failure

#### 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(ValueLob 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

#### needCleanup

    public boolean needCleanup()

Description copied from interface: `MVStore.Cleaner`
Determine if cleanup is needed. This is mainly performance optimization to avoid async call to cleanup().

Specified by:
  `needCleanup` in interface `MVStore.Cleaner`
Returns:
  true if cleanup is required at this time, false otherwise

#### cleanup

    public void cleanup(long oldestVersionToKeep)

Description copied from interface: `MVStore.Cleaner`
Actual procedure for cleanup after some unused store versions were dropped

Specified by:
  `cleanup` in interface `MVStore.Cleaner`
Parameters:
  `oldestVersionToKeep` - in this MVStore

#### doRemoveLob

    public void doRemoveLob(int tableId,
                            long lobId)