public byte[] serialize() throws IOException {
  ByteArrayOutputStream bytesOut=new ByteArrayOutputStream();
  DataOutputStream dataOut=new DataOutputStream(bytesOut);
  write(dataOut);
  return bytesOut.toByteArray();
}

public byte [ ] serialize ( ) throws IOException { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream ( ) ; DataOutputStream dataOut = new DataOutputStream ( bytesOut ) ; write ( dataOut ) ; return bytesOut . toByteArray ( ) ; }
returns the serialized representation of this object as a byte array .
