org.apache.jdbm.ObjectInputStream2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdbm Show documentation
Show all versions of jdbm Show documentation
JDBM provides TreeMap, HashMap and other collections backed up by disk storage. Now you can handle billions of items without ever running out of memory. JDBM is probably the fastest and the simpliest pure Java database.
The newest version!
package org.apache.jdbm;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInput;
import java.util.ArrayList;
/**
* An alternative to java.io.ObjectInputStream
which uses more efficient serialization
*/
public class ObjectInputStream2 extends DataInputStream implements ObjectInput {
public ObjectInputStream2(InputStream in) {
super(in);
}
public Object readObject() throws ClassNotFoundException, IOException {
//first read class data
ArrayList info = SerialClassInfo.serializer.deserialize(this);
Serialization ser = new Serialization(null,0,info);
return ser.deserialize(this);
}
}