Package org.h2.mvstore.db
Class LobStorageMap
- java.lang.Object
-
- org.h2.mvstore.db.LobStorageMap
-
- All Implemented Interfaces:
LobStorageInterface
public final 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLobStorageMap.BlobMetastatic classLobStorageMap.BlobReference
-
Constructor Summary
Constructors Constructor Description LobStorageMap(Database database)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close LobStorage and release all resourcesValueLobcopyLob(ValueLob old, int tableId)Copy a lob.ValueBlobcreateBlob(java.io.InputStream in, long maxLength)Create a BLOB object.ValueClobcreateClob(java.io.Reader reader, long maxLength)Create a CLOB object.java.io.InputStreamgetInputStream(long lobId, int tableId, long byteCount)Get the input stream for the given lobjava.io.InputStreamgetInputStream(long lobId, long byteCount)Get the input stream for the given lob, only called on server side of a TCP connection.booleanisReadOnly()Whether the storage is read-onlystatic MVMap<java.lang.Long,byte[]>openLobDataMap(TransactionStore txStore)Open map used to store LOB datastatic MVMap<java.lang.Long,LobStorageMap.BlobMeta>openLobMap(TransactionStore txStore)Open map used to store LOB metadatavoidremoveAllForTable(int tableId)Remove all LOBs for this table.voidremoveLob(ValueLob lob)Delete a LOB (from the database, if it is stored there).
-
-
-
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:LobStorageInterfaceCreate a BLOB object.- Specified by:
createBlobin interfaceLobStorageInterface- Parameters:
in- the input streammaxLength- the maximum length (-1 if not known)- Returns:
- the LOB
-
createClob
public ValueClob createClob(java.io.Reader reader, long maxLength)
Description copied from interface:LobStorageInterfaceCreate a CLOB object.- Specified by:
createClobin interfaceLobStorageInterface- Parameters:
reader- the readermaxLength- the maximum length (-1 if not known)- Returns:
- the LOB
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:LobStorageInterfaceWhether the storage is read-only- Specified by:
isReadOnlyin interfaceLobStorageInterface- Returns:
- true if yes
-
copyLob
public ValueLob copyLob(ValueLob old, int tableId)
Description copied from interface:LobStorageInterfaceCopy a lob.- Specified by:
copyLobin interfaceLobStorageInterface- Parameters:
old- the old lobtableId- the new table id- Returns:
- the new lob
-
getInputStream
public java.io.InputStream getInputStream(long lobId, long byteCount) throws java.io.IOExceptionDescription copied from interface:LobStorageInterfaceGet the input stream for the given lob, only called on server side of a TCP connection.- Specified by:
getInputStreamin interfaceLobStorageInterface- Parameters:
lobId- the lob idbyteCount- 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.IOExceptionDescription copied from interface:LobStorageInterfaceGet the input stream for the given lob- Specified by:
getInputStreamin interfaceLobStorageInterface- Parameters:
lobId- the lob idtableId- the able idbyteCount- 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:LobStorageInterfaceRemove all LOBs for this table.- Specified by:
removeAllForTablein interfaceLobStorageInterface- Parameters:
tableId- the table id
-
removeLob
public void removeLob(ValueLob lob)
Description copied from interface:LobStorageInterfaceDelete a LOB (from the database, if it is stored there).- Specified by:
removeLobin interfaceLobStorageInterface- Parameters:
lob- the lob
-
close
public void close()
Description copied from interface:LobStorageInterfaceClose LobStorage and release all resources- Specified by:
closein interfaceLobStorageInterface
-
-