0
下面的代碼拋出異常:NotSerializableException問題
public class TestObject implements Serializable{
private static final long serialVersionUID = 1L;
public String value;
}
DbByteArrayOutputStream out = new DbByteArrayOutputStream();
ObjectOutputStream objOut = new ObjectOutputStream(out);
objOut.writeObject(objOut);
objOut.flush();
out.writeTo(file);
objOut.close();
out.close();
public class DbByteArrayOutputStream extends ByteArrayOutputStream {
public DbByteArrayOutputStream() {
super();
}
public synchronized void writeTo (RandomAccessFile file) throws IOException {
byte[] data = super.buf;
int l = super.size();
file.writeInt(l);
file.write(data, 0, l);
}
}
爲什麼?謝謝。
愚蠢的錯誤。對不起。 – ilpizze 2010-12-03 14:33:20