我有一个包含以下内容的包装器类
class myWrapperClass {
Map<Long, myInnerClass> myMap;
int myInt1;
int myInt2;
}
class myInnerClass {
int myInnerInt;
long myInnerLong;
}
到目前为止,我想拥有一个customWritable
@Override
public void write(DataOutput out) throws IOException {
out.writeInt(this.myInt1);
out.writeInt(this.myInt2);
// What do I do here
}
@Override
public void readFields(DataInput in) throws IOException {
myInt1 = in.readInt();
myInt2 = in.readShort();
// What do I do here
}
如果我有一个自定义对象,我不确定如何写DataOutput
和从中读取。
有人可以给我指明方向吗?