Class IONodeStore<USERKEY>
- java.lang.Object
-
- com.github.basking2.sdsai.dsds.io.IONodeStore<USERKEY>
-
- Type Parameters:
USERKEY- The user key.
- All Implemented Interfaces:
NodeStore<USERKEY,byte[],java.io.InputStream>
public class IONodeStore<USERKEY> extends java.lang.Object implements NodeStore<USERKEY,byte[],java.io.InputStream>
An implementation ofNodeStorethat stores and returns streams of data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIONodeStore.NodeAccessor<USERKEY>How aIONodeStoreaccessesNodedata.
-
Constructor Summary
Constructors Constructor Description IONodeStore(IONodeStore.NodeAccessor<USERKEY> accessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]convert(USERKEY key)By default this returns the key parameter.byte[]generateKey(Node<USERKEY,byte[]> node, java.io.InputStream inputStream)Generate a key to store a node or data element.java.io.InputStreamloadData(byte[] key)Load the user's data.Node<USERKEY,byte[]>loadNode(byte[] key)Load a node object fromNodeStore.voidremoveData(byte[] key)Remove the given data key.voidremoveNode(byte[] key)Remove the given node key.voidstore(byte[] key, Node<USERKEY,byte[]> node)Store the given node.voidstore(byte[] key, java.io.InputStream data)Store user data.
-
-
-
Constructor Detail
-
IONodeStore
public IONodeStore(IONodeStore.NodeAccessor<USERKEY> accessor)
-
-
Method Detail
-
loadData
public java.io.InputStream loadData(byte[] key)
Description copied from interface:NodeStoreLoad the user's data.
-
loadNode
public Node<USERKEY,byte[]> loadNode(byte[] key)
Description copied from interface:NodeStoreLoad a node object fromNodeStore.
-
store
public void store(byte[] key, java.io.InputStream data)Description copied from interface:NodeStoreStore user data. If an object already exists at the key, it should be replaced.
-
store
public void store(byte[] key, Node<USERKEY,byte[]> node)Description copied from interface:NodeStoreStore the given node. If an object already exists at the key, it should be replaced.
-
removeNode
public void removeNode(byte[] key)
Description copied from interface:NodeStoreRemove the given node key. If the key does not exist, this should return without error.- Specified by:
removeNodein interfaceNodeStore<USERKEY,byte[],java.io.InputStream>
-
removeData
public void removeData(byte[] key)
Description copied from interface:NodeStoreRemove the given data key. If the key does not exist, this should return without error.- Specified by:
removeDatain interfaceNodeStore<USERKEY,byte[],java.io.InputStream>
-
generateKey
public byte[] generateKey(Node<USERKEY,byte[]> node, java.io.InputStream inputStream)
Description copied from interface:NodeStoreGenerate a key to store a node or data element. This key must be unique.- Specified by:
generateKeyin interfaceNodeStore<USERKEY,byte[],java.io.InputStream>- Parameters:
node- This is provided to implementations for some context. If generateKey is being called for the purposes of storing a user key, this will be null.inputStream- If a key is being generated for a user key value, it will be passed along. This is most useful when things like aPagedListare adding a value, but the List API does not provide a way to specify a key.
-
-