Hi all
Am trying to dump a class to a ByteBuffer.
Am using Enums in the class and cant find a way to do it with latest J2SE on Ubuntu 10.10
Compiles with an inconvertible type message. Is the answer to forget about using enums in Java at this point in time, or is there a way to do it
Code:
// Simple page structure
import java.awt.*;
import java.nio.*;
class Simp extends Object{
public enum IpType{P0,IX,DT,DB;}
IpType tag,type;
Byte updated;
static ByteBuffer stgB;
int blk;
private Simp(int pgSize){
tag=IpType.DB; type=IpType.P0; updated=0; blk=0;}
private int dump(){
stgB=ByteBuffer.allocate(256);
stgB.put((int)tag);
stgB.put((int)type);
stgB.put(updated);
stgB.putInt(blk);
return stgB.position();}
}
Any thoughts?
Bookmarks