org.nustaq.serialization.serializers.FSTBitSetSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fst Show documentation
Show all versions of fst Show documentation
A fast java serialization drop in-replacement and some serialization based utils such as Structs and OffHeap Memory.
The newest version!
package org.nustaq.serialization.serializers;
import org.nustaq.serialization.FSTBasicObjectSerializer;
import org.nustaq.serialization.FSTClazzInfo;
import org.nustaq.serialization.FSTObjectInput;
import org.nustaq.serialization.FSTObjectOutput;
import java.io.IOException;
import java.util.BitSet;
public class FSTBitSetSerializer extends FSTBasicObjectSerializer {
@Override
public void writeObject(FSTObjectOutput out, Object toWrite, FSTClazzInfo clzInfo,
FSTClazzInfo.FSTFieldInfo referencedBy, int streamPosition) throws IOException {
out.writeObject(((BitSet)toWrite).toLongArray());
}
@Override
public boolean alwaysCopy(){
return true;
}
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo,
FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
long[] l = (long[])in.readObject();
Object res = BitSet.valueOf(l);
return res;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy