org.mapdb.serializer.GroupSerializerObjectArray Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapdb Show documentation
Show all versions of mapdb Show documentation
MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap memory. It is a fast, scalable and easy to use embedded Java database.
package org.mapdb.serializer;
import org.mapdb.DataIO;
import org.mapdb.DataInput2;
import org.mapdb.DataOutput2;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
/**
* Created by jan on 2/29/16.
*/
public abstract class GroupSerializerObjectArray implements GroupSerializer {
@Override public void valueArraySerialize(DataOutput2 out, Object vals) throws IOException {
for(Object o:(Object[])vals){
serialize(out, (A) o);
}
}
@Override public Object[] valueArrayDeserialize(DataInput2 in, int size) throws IOException {
Object[] ret = new Object[size];
for(int i=0;i)this);
}
@Override public Object[] valueArrayToArray(Object vals){
return (Object[]) vals;
}
@Override public int valueArraySearch(Object keys, A key, Comparator comparator){
if(comparator==this)
return valueArraySearch(keys, key);
return Arrays.binarySearch((Object[])keys, key, comparator);
}
}