T
- the type of the item that should be embeddedpublic interface AbstractIndexedEmbedding<T> extends AbstractEmbedding<T>
AbstractEmbedding
where each embedded item can be assigned an integer index.Modifier and Type | Method and Description |
---|---|
T |
decode(byte[] byteArray)
Decodes the given byte array into an object of input parameter type.
|
long |
embed(T item)
Embeds an item.
|
byte[] |
encode(T input)
Encodes an object of input type into a byte array.
|
java.util.Optional<T> |
unembed(long index)
Returns the item corresponding to the given index.
|
embed, hasItem
byte[] encode(T input) throws java.io.IOException
Embedding
objects.input
- the input object to be encodedjava.io.IOException
- if there is an error while encodingT decode(byte[] byteArray) throws java.io.IOException
byteArray
- the byte array to be decodedjava.io.IOException
- if there was an error while decodinglong embed(T item)
item
- the item to embedjava.util.Optional<T> unembed(long index)
index
- the index