Methods Summary |
---|
public static void | writeFixedPoint0230(java.nio.ByteBuffer bb, double v)
int result = (int) (v * (1 << 30));
bb.put((byte) ((result & 0xFF000000) >> 24));
bb.put((byte) ((result & 0x00FF0000) >> 16));
bb.put((byte) ((result & 0x0000FF00) >> 8));
bb.put((byte) ((result & 0x000000FF)));
|
public static void | writeFixedPoint1616(java.nio.ByteBuffer bb, double v)
int result = (int) (v * 65536);
bb.put((byte) ((result & 0xFF000000) >> 24));
bb.put((byte) ((result & 0x00FF0000) >> 16));
bb.put((byte) ((result & 0x0000FF00) >> 8));
bb.put((byte) ((result & 0x000000FF)));
|
public static void | writeFixedPoint88(java.nio.ByteBuffer bb, double v)
short result = (short) (v * 256);
bb.put((byte) ((result & 0xFF00) >> 8));
bb.put((byte) ((result & 0x00FF)));
|
public static void | writeIso639(java.nio.ByteBuffer bb, java.lang.String language)
if (language.getBytes().length != 3) {
throw new IllegalArgumentException("\"" + language + "\" language string isn't exactly 3 characters long!");
}
int bits = 0;
for (int i = 0; i < 3; i++) {
bits += (language.getBytes()[i] - 0x60) << (2 - i) * 5;
}
writeUInt16(bb, bits);
|
public static void | writeUInt16(java.nio.ByteBuffer bb, int i)
i = i & 0xFFFF;
writeUInt8(bb, i >> 8);
writeUInt8(bb, i & 0xFF);
|
public static void | writeUInt16BE(java.nio.ByteBuffer bb, int i)
i = i & 0xFFFF;
writeUInt8(bb, i & 0xFF);
writeUInt8(bb, i >> 8);
|
public static void | writeUInt24(java.nio.ByteBuffer bb, int i)
i = i & 0xFFFFFF;
writeUInt16(bb, i >> 8);
writeUInt8(bb, i);
|
public static void | writeUInt32(java.nio.ByteBuffer bb, long u)
bb.putInt((int) u);
|
public static void | writeUInt32BE(java.nio.ByteBuffer bb, long u)
assert u >= 0 && u <= 1L << 32 : "The given long is not in the range of uint32 (" + u + ")";
writeUInt16BE(bb, (int) u & 0xFFFF);
writeUInt16BE(bb, (int) ((u >> 16) & 0xFFFF));
|
public static void | writeUInt64(java.nio.ByteBuffer bb, long u)
bb.putLong(u);
|
public static void | writeUInt8(java.nio.ByteBuffer bb, int i)
i = i & 0xFF;
bb.put((byte) i);
|
public static void | writeUtf8String(java.nio.ByteBuffer bb, java.lang.String string)
bb.put(Utf8.convert(string));
writeUInt8(bb, 0);
|