public final int size ()

Returns the current value of the counter written, the number of bytes written to this data output stream so far. If the counter overflows, it will be wrapped to Integer.MAX_VALUE.

Returns:  the value of the written field.

See also:
java.io.DataOutputStream.written