Java Utililty Methods OutputStream Write Int

List of utility methods to do OutputStream Write Int

Description

The list of methods to do OutputStream Write Int are organized into topic(s).

Method

voidwriteInt(OutputStream out, int x)
Write an integer (4 bytes).
out.write((byte) (x >> 24));
out.write((byte) (x >> 16));
out.write((byte) (x >> 8));
out.write((byte) x);
voidwriteInt(OutputStream out, int x)
Writes an integer to the output stream.
out.write((x >>> 24) & 0xFF);
out.write((x >>> 16) & 0xFF);
out.write((x >>> 8) & 0xFF);
out.write(x & 0xFF);
voidwriteInt(OutputStream output, int value)
Write int, little endian
byte[] writeBuffer = new byte[4];
writeBuffer[0] = (byte) (value & 0xFF);
writeBuffer[1] = (byte) ((value >> 8) & 0xFF);
writeBuffer[2] = (byte) ((value >> 16) & 0xFF);
writeBuffer[3] = (byte) ((value >> 24) & 0xFF);
output.write(writeBuffer, 0, 4);
voidwriteInt(OutputStream outputStream, int integerToWrite)
write Int
outputStream.write(intToByteArray(integerToWrite));
voidwriteInt(OutputStream stream, int value)
write Int
for (int i = 0; i < 4; ++i) {
    stream.write(value & MASK);
    value >>= BITS_IN_BYTE;