解决方案 »

  1.   

    不是用OutputFileStream寫到文件中嗎?
      

  2.   

    和下载一样啊   读到一定的缓存 就写到文件里面去
    byte[] buf = new byte[1024 * 10];
    int read = 0;
    while ((read = inputStream.read(buf)) != -1) {
           file.write(buf, 0, read);}
      

  3.   


    存储到txt里面呢
    FileOutputStream outStream = new FileOutputStream("/sdcard/"+name+".txt",true);
    有这方面的例子或者讲解吗?
      

  4.   

    你有缓存变量,直接贴代码。
    BufferedOutputStream out=new BufferedOutputStream(new FileOutputStream("XXX.txt")); 
    byte[] b= new byte[1024];
    out.write(b, 0, b.length); 
    当然,我这是简单的写法,你还要判断一下,因为我这里是小于等于1024个字节,如果多余,你就要使用while循环
      

  5.   

    public void saveToSDCard(String name, String content) throws Exception{
             //获取外存储设备路径Environment.getExternalStorageDirectory()
     File file = new File(Environment.getExternalStorageDirectory(),name+".txt");
     FileOutputStream outStream = new FileOutputStream(file);
             outStream.write(content.getBytes());
         outStream.close();

    }
    看了这样一段代码,没有理解整个存储的流程
      

  6.   

           count = System.in.read(buffer);   
    read(byte)不能读short[] buffer
      

  7.   

    先存储到一个临时文件 然后 stream 到一个 txt文件
      

  8.   

    short[] buffer 中怎么获取固定音频的音量啊?
      

  9.   

    已解决使用方法:
    按照正常的文件的读取原则
    File txt = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + "buf.txt");//存储文件路径+文件名。毫秒时间+buf。txt
    if (!txt.exists()) {
    try {
    // 在指定的文件夹中创建文件
    txt.createNewFile();
    } catch (Exception e) {
    }                                                                                                                                                                                                                                                                                                                    
    }
    FileWriter out = new FileWriter(txt);t = new FileWriter(txt);String str = "";
    str = str + data.get(k) + "\n\t";out.write(str);
    out.close();