我想将一个字节数组写入文件。这是网络http://allmybrain.com/2012/03/16/quick-convert-raw-g711-ulaw-audio-to-a-au-file/中的代码
import struct
header = [ 0x2e736e64, 24, 0xffffffff, 1, 8000, 1 ]
o=open('out.au','wb')
o.write ( struct.pack ( ">IIIIII", *header ) )
raw = open('in.raw','rb').read()
o.write(raw)
o.close()
我转换为 java :
byte [] header= { 0x2e736e64, 24, 0xffffffff, 1, 8000, 1 };
FileOutputStream out = new FileOutputStream(file);
out.write(header);
但这是错误的。你能帮我修一下吗。谢谢