I\'m trying to write TIFF IFDs, and I\'m looking for a simple way to do the following (this code obviously is wrong but it gets the idea across of what I want):
ByteBuffer is apparently the better choice. You can also write some convenience functions like this,
public static void writeShortLE(DataOutputStream out, short value) {
out.writeByte(value & 0xFF);
out.writeByte((value >> 8) & 0xFF);
}
public static void writeIntLE(DataOutputStream out, int value) {
out.writeByte(value & 0xFF);
out.writeByte((value >> 8) & 0xFF);
out.writeByte((value >> 16) & 0xFF);
out.writeByte((value >> 24) & 0xFF);
}