All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mapdb.serializer.GroupSerializerObjectArray Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.1.0
Show newest version
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);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy