NotSerializableException problem
<p>the following code throws the exception:</p>

<pre><code>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);
   }
}
</code></pre>

<p>Why? Thanks.</p>
