问题 出现的异常为:java.lang.IllegalArgumentException: File /mnt/sdcard/crazyit.bin contains a pathseparator。

主要是由于在打开文件的输出流时使用的openFileOutput()方法的第一参数用于指定文件名称,不能包含路径分隔符“/”
解决方法   //       FileInputStream fis =
openFileInput(sdCardDir.getCanonicalPath()+FILE_NAME);改为                FileInputStream fis = new
FileInputStream(sdCardDir.getCanonicalPath()+FILE_NAME)

对于InputStream的读取有两种方法

1.inputstream---》byte---》String

2.inputstream--->inputstreamReader---->BufferedRead-->string

android之sd文件读取模块

FileInputStream fileInputStream = null;
        try {
            File file = new File(Environment.getExternalStorageDirectory()
                    + "/wipe.txt");

if (!file.exists())
                file.createNewFile();
            fileInputStream = new FileInputStream(file);
            BufferedReader bufferedReader = new BufferedReader(
                    new InputStreamReader(fileInputStream));
            String temapp;

while ((temapp = bufferedReader.readLine()) != null) {

apps.add(temapp);
                Toast.makeText(MainActivity.this, temapp, Toast.LENGTH_LONG)
                        .show();
            }
            bufferedReader.close();

} catch (FileNotFoundException e) {
            // TODO 自动生成的 catch 块
            e.printStackTrace();
        } catch (IOException e) {
            // TODO 自动生成的 catch 块
            e.printStackTrace();
        } finally {
            if (fileInputStream != null)
                try {
                    fileInputStream.close();
                } catch (IOException e2) {
                    // TODO: handle exception
                    e2.printStackTrace();
                }
        }

android file path的更多相关文章

  1. 安卓各文件存储路径汇总(Android file path)

    写下来,省得以后不记得到处翻: Environment.getDataDirectory() = /data Environment.getDownloadCacheDirectory() = /ca ...

  2. 《ArcGIS Runtime SDK for Android开发笔记》——问题集:Error:Error: File path too long on Windows, keep below 240 characters

    1.前言 在使用Android Studio开发环境时,经常会爆出以下错误,虽然具体细节内容各有不同,但是说明的都是同一个问题,在windows中使用过长的路径,超过240字符. Error:Erro ...

  3. Android File Hierarchy : System Structure Architecture Layout

    Most of the Android user are using their Android phone just for calls, SMS, browsing and basic apps, ...

  4. [LeetCode] Longest Absolute File Path 最长的绝对文件路径

    Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsub ...

  5. Android中Path类的lineTo方法和quadTo方法画线的区别

    转载:http://blog.csdn.net/stevenhu_223/article/details/9229337 当我们需要在屏幕上形成画线时,Path类的应用是必不可少的,而Path类的li ...

  6. Longest Absolute File Path

    Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsub ...

  7. android 利用Path.cubicTo 画 贝塞尔曲线

    Path.cubicTo void android.graphics.Path.cubicTo(float x1, float y1, float x2, float y2, float x3, fl ...

  8. OS X 禁止Android File Transfer自动启动

    操作步骤 关闭Android File Manager 在Activity Manager中退出Android File Manager Agent进程 在Applications中,将Android ...

  9. Leetcode: Longest Absolute File Path

    Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsub ...

随机推荐

  1. BUCK-BOOST反激变压器设计

    Buck-Boost电路中,最低电压为其最恶劣情况 以下图为例: 注:1.Np为初级绕组匝数,Ns为次级绕组匝数: 2.Vmos为MOS最大耐压值,1为整流管压降,Vl为漏,Vl=100V,Vmos选 ...

  2. GTAC 2015 Schedule

    之前发的GTAC 2015将于11月10号和11号召开 现在时刻表也出来啦 https://developers.google.com/google-test-automation-conferenc ...

  3. CodeForces 466E Information Graph --树形转线性+并查集

    题意:有三种操作: 1.新增一条边从y连向x,此前x没有父节点 2.x接到一份文件,(文件标号逐次递增),然后将这份文件一路上溯,让所有上溯的节点都接到这份文件 3.查询某个节点x是否接到过文件F 解 ...

  4. win10输入法切换快捷键怎么设置

    win10输入法切换快捷键怎么修改?以前都是习惯使用(Ctrl+Shift) 现在新版的Win10默认的是[Shift+Alt]那要怎么把它改回来呢? http://jingyan.baidu.com ...

  5. [No000006]苏格拉底与失恋者的对话

    苏(苏格拉底): 孩子,为什么悲伤? 失(失恋者): 我失恋了. 苏: 哦,这很正常. 如果失恋了没有悲伤,恋爱大概也就没有什么味道了.可是,年轻人,我怎么发现你对失恋的投入甚至比对恋爱的投入还要倾心 ...

  6. poj2676 Sudoku

    Sudoku Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17953   Accepted: 8688   Special ...

  7. Oracle死锁查询及处理

    一.数据库死锁的现象程序在执行的过程中,点击确定或保存按钮,程序没有响应,也没有出现报错.二.死锁的原理当对于数据库某个表的某一列做更新或删除等操作,执行完毕后该条语句不提交,另一条对于这一列数据做更 ...

  8. c#匿名类,匿名对象

    何谓匿名类,其实本质和普通定义的类一样,只不过是由系统的编译器来完成的,首先举个例子. 一般情况 //声明一个类,包含贴别多的字段 public class Person() { public str ...

  9. 在移动端如何选择字体大小和布局的单位,px或dp?

    android开发中,文字大小的单位是sp,非文字的尺寸单位用dp,但是我们在设计稿用的单位是px.这些单位如何换算,是设计师.开发者需要了解的关键. 简单理解的话,px(像素)是我们UI设计师在PS ...

  10. css实现省略号

    样式: {width: 160px; overflow: hidden; text-overflow:ellipsis; white-space: nowrap;} 说明: white-space: ...