Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
private int __id = -1;
private final static net.sourceforge.floggy.persistence.PersistableMetadata __persistableMetadata = new net.sourceforge.floggy.persistence.PersistableMetadata("TestFloat-1917858018");
public net.sourceforge.floggy.persistence.PersistableMetadata __getPersistableMetadata() {
    return __persistableMetadata;
}
public void __load(byte[] buffer) throws java.lang.Exception {
    java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(buffer);
    java.io.DataInputStream dis = new java.io.DataInputStream(bais);
    this.x = dis.readFloat();
    dis.close();
}
public void __load(int id) throws java.lang.Exception {
    javax.microedition.rms.RecordStore rs = net.sourceforge.floggy.persistence.PersistableManager.getRecordStore(__persistableMetadata);
    byte[] buffer = rs.getRecord(id);
    rs.closeRecordStore();
    this.__load(buffer);
    this.__id = id;
}
public int __save() throws java.lang.Exception {
    java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
    java.io.DataOutputStream dos = new java.io.DataOutputStream(baos);
    javax.microedition.rms.RecordStore rs = net.sourceforge.floggy.persistence.PersistableManager.getRecordStore(__persistableMetadata);
    dos.writeFloat(this.x);
    if(this.__id == -1) {
        this.__id = rs.addRecord(baos.toByteArray(), 0, baos.size());
    }
    else {
        rs.setRecord(this.__id, baos.toByteArray(), 0, baos.size());
    }
    rs.closeRecordStore();
    dos.close();
    return this.__id;
}
public void __delete() throws java.lang.Exception {
    if (this.__id != -1) {
        javax.microedition.rms.RecordStore rs = net.sourceforge.floggy.persistence.PersistableManager.getRecordStore(__persistableMetadata);
        rs.deleteRecord(this.__id);
        rs.closeRecordStore();
    }
}
New to GrepCode? Check out our FAQ X