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;
}
What happens if this method is interrupted by another thread that
proceeds to write data onto the same stream?Solution: