<i id='IeuvB'><tr id='IeuvB'><dt id='IeuvB'><q id='IeuvB'><span id='IeuvB'><b id='IeuvB'><form id='IeuvB'><ins id='IeuvB'></ins><ul id='IeuvB'></ul><sub id='IeuvB'></sub></form><legend id='IeuvB'></legend><bdo id='IeuvB'><pre id='IeuvB'><center id='IeuvB'></center></pre></bdo></b><th id='IeuvB'></th></span></q></dt></tr></i><div id='IeuvB'><tfoot id='IeuvB'></tfoot><dl id='IeuvB'><fieldset id='IeuvB'></fieldset></dl></div>

    <tfoot id='IeuvB'></tfoot>
    • <bdo id='IeuvB'></bdo><ul id='IeuvB'></ul>

    <legend id='IeuvB'><style id='IeuvB'><dir id='IeuvB'><q id='IeuvB'></q></dir></style></legend>
    1. <small id='IeuvB'></small><noframes id='IeuvB'>

      1. 安卓文件拷贝

        Android file copy(安卓文件拷贝)
          <bdo id='0nNTm'></bdo><ul id='0nNTm'></ul>
          <legend id='0nNTm'><style id='0nNTm'><dir id='0nNTm'><q id='0nNTm'></q></dir></style></legend>
            <tbody id='0nNTm'></tbody>

          <small id='0nNTm'></small><noframes id='0nNTm'>

              <i id='0nNTm'><tr id='0nNTm'><dt id='0nNTm'><q id='0nNTm'><span id='0nNTm'><b id='0nNTm'><form id='0nNTm'><ins id='0nNTm'></ins><ul id='0nNTm'></ul><sub id='0nNTm'></sub></form><legend id='0nNTm'></legend><bdo id='0nNTm'><pre id='0nNTm'><center id='0nNTm'></center></pre></bdo></b><th id='0nNTm'></th></span></q></dt></tr></i><div id='0nNTm'><tfoot id='0nNTm'></tfoot><dl id='0nNTm'><fieldset id='0nNTm'></fieldset></dl></div>
              • <tfoot id='0nNTm'></tfoot>
                  本文介绍了安卓文件拷贝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我发现从 SD 卡上的文本文件一次读取一行非常慢.我想如果文件在内部存储器中可能会更快,所以我想将文件从 SD 卡复制到内部存储器.

                  I am finding that reading one line at a time from a text file on the SD card is rather slow. I imagine that it might be quicker if the file is in internal memory, so I want to copy files from the SD card to internal storage.

                  我可以在网上找到的文件复制示例似乎涉及一次将一个字节从 InputStream 复制到 OutputStream 或从 FileReader 复制到 FileWriter.这真的是最快最有效的方法吗?

                  The file copy examples I can find on the web seem to involve copying one byte at a time from an InputStream to an OutputStream or from a FileReader to a FileWriter. Is this really the quickest and most efficient method?

                  推荐答案

                  如果您将文件拉入应用程序中,我建议您做的是读取数据,然后将您收集的内存数据填充到一些一种阅读器(也许是 BufferedReader),这样您就可以从那里阅读这些行.

                  If you are pulling the file in for use in your application what I suggest you do is read in the data then stuff the in memory data you have collected into some kind of reader (BufferedReader perhaps) so that you can then read the lines from there.

                  这是我通常做的一个例子:

                  Here is an example of what I typically do:

                  // Assumption: I already have the file object I want to read
                  // Note: I'm not doing any error handling.
                  InputStream input = new FileInputStream(file);
                  ByteArrayOutputStream baos = new ByteArrayOutputStream();
                  byte[] buffer = new byte[1024];
                  int bytesRead = 0;
                  while( (bytesRead = input.read(buffer)) > 0){
                      baos.write(buffer, 0, bytesRead);
                  }
                  StringReader stringReader = new StringReader( new String(baos.toByteArray()) );
                  BufferedReader bufferedReader = new BufferedReader( stringReader );
                  for(String line : bufferedReader.readLine()){
                      // TODO: Handle each line appropriately or something
                      Log.d("Reading Data Example", line);
                  }
                  

                  这篇关于安卓文件拷贝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  what#39;s property copy means in Cocoa#39;s Framework?(like UITabBar#39;s items property)(Cocoa 框架中的属性副本是什么意思?(如 UITabBar 的 items 属性))
                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
                  Difference between retain and copy?(保留和复制的区别?)
                  Can`t copy file from bundle to documents directory in iOS(无法将文件从捆绑包复制到 iOS 中的文档目录)

                    <bdo id='KRzVR'></bdo><ul id='KRzVR'></ul>
                      <tbody id='KRzVR'></tbody>
                      1. <tfoot id='KRzVR'></tfoot>
                        <legend id='KRzVR'><style id='KRzVR'><dir id='KRzVR'><q id='KRzVR'></q></dir></style></legend>
                        <i id='KRzVR'><tr id='KRzVR'><dt id='KRzVR'><q id='KRzVR'><span id='KRzVR'><b id='KRzVR'><form id='KRzVR'><ins id='KRzVR'></ins><ul id='KRzVR'></ul><sub id='KRzVR'></sub></form><legend id='KRzVR'></legend><bdo id='KRzVR'><pre id='KRzVR'><center id='KRzVR'></center></pre></bdo></b><th id='KRzVR'></th></span></q></dt></tr></i><div id='KRzVR'><tfoot id='KRzVR'></tfoot><dl id='KRzVR'><fieldset id='KRzVR'></fieldset></dl></div>

                        <small id='KRzVR'></small><noframes id='KRzVR'>