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字节

原文地址:https://www.cnblogs.com/passedbylove/p/11811381.html