Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在输入流中复制字节时,是否可以播放部分mp3音频文件_Android_Inputstream_Android Mediaplayer - Fatal编程技术网

Android 在输入流中复制字节时,是否可以播放部分mp3音频文件

Android 在输入流中复制字节时,是否可以播放部分mp3音频文件,android,inputstream,android-mediaplayer,Android,Inputstream,Android Mediaplayer,两个设备通过蓝牙连接。是否可以在接收mp3歌曲时播放。 while(fileSize>=TConstants.CHUNK\u SIZE) { int readLen=0; readLen=inputStream.read(buf,0,TConstants.CHUNK\u SIZE); if(readLen0) { buf=新字节[(int)文件大小]; len=inputStream.read(buf); if(len

两个设备通过蓝牙连接。是否可以在接收mp3歌曲时播放。 while(fileSize>=TConstants.CHUNK\u SIZE) { int readLen=0; readLen=inputStream.read(buf,0,TConstants.CHUNK\u SIZE); if(readLen<0) 抛出新的TException(TException.EXCEPTION\u READ\u文件)

out.write(buf,0,readLen);
len+=readLen;
fileSize-=readLen;
if(侦听器!=null&((len/TConstants.CHUNK\u SIZE)!=prev))
{
prev=len/TConstants.CHUNK\u SIZE;
Log.d(标记“块读取”+prev+”);
ReceiverToxing.setReadFileSize(len);
监听器。onChunkRead(接管人);
//showSpinnerProgress(文件传输模型);
}
}
而(文件大小>0)
{
buf=新字节[(int)文件大小];
len=inputStream.read(buf);
if(len<0)
{
抛出新的TException(TException.EXCEPTION\u READ\u文件);
}
fileSize-=len;
out.write(buf,0,len);
}
out.close();
}
捕获(IOE异常)
{
Log.e(标记“copyFile中的异常:”,e);
out.close();
抛出新的TException(e,TException.EXCEPTION\u READ\u文件);
}
                out.write(buf, 0, readLen);
                len += readLen;
                fileSize -= readLen;
                if (listener!=null && ((len / TConstants.CHUNK_SIZE) != prev))
                {
                    prev = len / TConstants.CHUNK_SIZE;
                    Log.d(TAG, "Chunk read " + prev + "");
                    receiverConsignment.setReadFileSize(len);
                    listener.onChunkRead(receiverConsignment);
                    // showSpinnerProgress(fileTransferModel);
                }
            }

            while (fileSize > 0)
            {
                buf = new byte[(int) fileSize];
                len = inputStream.read(buf);
                if (len < 0)
                {
                    throw new TException(TException.EXCEPTION_READ_FILE);
                }
                fileSize -= len;
                out.write(buf, 0, len);
            }
            out.close();
        }
        catch (IOException e)
        {
            Log.e(TAG, "Exception in copyFile: ", e);
            out.close();
            throw new TException(e, TException.EXCEPTION_READ_FILE);
        }