我正在尝试编写 TIFF IFD,并且正在寻找一种简单的方法来执行以下操作(这段代码显然是错误的,但它表达了我想要的想法):
out.writeChar(12) (bytes 0-1)
out.writeChar(259) (bytes 2-3)
out.writeChar(3) (bytes 4-5)
out.writeInt(1) (bytes 6-9)
out.writeInt(1) (bytes 10-13)
会写:
0c00 0301 0300 0100 0000 0100 0000
我知道如何让写入方法占用正确的字节数(writeInt、writeChar 等),但我不知道如何让它以小尾数法写入。有人知道吗?
也许你应该尝试这样的事情:
ByteBuffer buffer = ByteBuffer.allocate(1000);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putChar((char) 12);
buffer.putChar((char) 259);
buffer.putChar((char) 3);
buffer.putInt(1);
buffer.putInt(1);
byte[] bytes = buffer.array();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)