Here's the writeInt()
method from
java.io.DataOutputStream
:
public final void writeInt(int v) throws IOException {
OutputStream out = this.out;
out.write((v >>> 24) & 0xFF);
out.write((v >>> 16) & 0xFF);
out.write((v >>> 8) & 0xFF);
out.write((v >>> 0) & 0xFF);
written += 4;
}
Solution:
Never use the same stream in more than one thread
Don't chain multiple filters in parallel to one underlying stream (series is OK)