我需要阅读从QuickTime文件unsigned int类型,并把它写回到另一个QuickTime文件。Java的阅读unsigned int类型,存储和写回
目前我读的unsigned int的成长,但在写回我从来没有设法写的确切数字早在4个字节为unsigned int。长期有正确的价值,我需要回信。 (如3289763894或370500) 我无法甚至读取写小的数目,然后是Integer.MAX_VALUE(如2997)。
我使用下面的方法来写回
public void writeUInt32(long uint32,DataOutputStream stream) throws IOException {
writeUInt16((int) (uint32 & 0xffff0000) >> 16,stream);
writeUInt16((int) uint32 & 0x0000ffff,stream);
}
public void writeUInt16(int uint16,DataOutputStream stream) throws IOException {
writeUInt8(uint16 >> 8, stream);
writeUInt8(uint16, stream);
}
public void writeUInt8(int uint8,DataOutputStream stream) throws IOException {
stream.write(uint8 & 0xFF);
}
任何帮助,将不胜感激的价值。
在java中,没有这样的事情作为unsigned int。而长有8个字节。 –
因为它长是我们最接近的一个unsigned int。 –