编程语言
首页 > 编程语言> > java中byte数组,二进制binary安装chunk大小读取数据

java中byte数组,二进制binary安装chunk大小读取数据

作者:互联网

int CHUNKED_SIZE = 8000;
public void recognizeText(byte[] data) throws InterruptedException, IOException {

        init();

        byte[] buffer = new byte[CHUNKED_SIZE];

        ByteArrayInputStream stream = new ByteArrayInputStream(data);

        while (stream.read(buffer) != -1)
        {
            send(buffer);
        }
        send("EOS");
    }

String fileName = "F:\\aaa.wav";
RandomAccessFile raf = new RandomAccessFile(fileName,"r");
raf.skipBytes(44);
byte [] audioData = new byte[(int)(raf.length() - 44)];
raf.readFully(audioData);
recognizeText(audioData);

每次读取8000字节

标签:raf,binary,java,读取数据,stream,audioData,buffer,new,byte
来源: https://www.cnblogs.com/passedbylove/p/11811381.html