Java Utililty Methods OutputStream Write Endian

List of utility methods to do OutputStream Write Endian

Description

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

Method

voidwriteInt16(OutputStream out, int i)
write Int
writeInt8(out, (i >> 8) & 0xFF);
writeInt8(out, i & 0xFF);
voidwriteInt24(OutputStream os, int value)
write Int
os.write(value >> 16);
os.write(value >> 8);
os.write(value >> 0);
intwriteInt24(OutputStream out, int value)
Writes a 24 bit integer to specified output stream.
int res = 0;
if (out != null) {
    for (int i = 0, shift = 0; i < 3; i++, shift += 8) {
        out.write((value >>> shift) & 0xff);
        res++;
return res;
...
voidwriteInt2BE(OutputStream out, int v)
write Int BE
out.write((int) ((v >> 8) & 0xFF));
out.write((int) (v & 0xFF));
voidwriteInt2BE(OutputStream out, int v)
write Int BE
byte[] b2 = new byte[2];
putInt2BE(b2, 0, v);
out.write(b2);
voidwriteInt32(OutputStream in_stream, int in_value)
Writes a signed 32-bit integer value to the given output stream.
byte[] bytes = new byte[4];
bytes[0] = (byte) (in_value & 0xFF);
bytes[1] = (byte) (in_value >>> 8 & 0xFF);
bytes[2] = (byte) (in_value >>> 16 & 0xFF);
bytes[3] = (byte) (in_value >>> 24 & 0xFF);
in_stream.write(bytes);
voidwriteInt32BE(OutputStream os, int val)
write Int BE
os.write(val >> 24);
os.write(val >> 16);
os.write(val >> 8);
os.write(val);