问题 出现的异常为: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. AC日记——单词的长度 openjudge 1.7 24

    24:单词的长度 总时间限制:  1000ms 内存限制:  65536kB 描述 输入一行单词序列,相邻单词之间由1个或多个空格间隔,请对应地计算各个单词的长度. 注意,如果有标点符号(如连字符,逗 ...

  2. AC日记——加密的病历单 openjudge 1.7 12

    12:加密的病历单 总时间限制:  1000ms 内存限制:  65536kB 描述 小英是药学专业大三的学生,暑假期间获得了去医院药房实习的机会. 在药房实习期间,小英扎实的专业基础获得了医生的一致 ...

  3. Seajs是什么及sea.js 由来,特点以及优势

    Seajs是什么及sea.js 由来,特点以及优势 这篇文章主要介绍了Seajs的相关知识和和学习心得,适合刚接触SeaJS的同学,需要的朋友可以参考下,有更好的新手教程或文档,欢迎推荐.分享   1 ...

  4. Socket用法详解

    在客户/服务器通信模式中,客户端需要主动创建与服务器的Socket(套接字),服务端收到了客户端的请求,也会创建与客户端连接的Socket. Scoket可以看作两端通信的收发器,服务端和客户端都通过 ...

  5. 5.Transact-SQL编程

    转载于:http://www.cnblogs.com/hoojo/archive/2011/07/19/2110862.html Transact-SQL中的存储过程,非常类似于Java语言中的方法, ...

  6. laravel5.3引入第三方类库的方法

    laravel版本:5.3 今天做的是引入第三方的phpquery类库,方法: 在laravel的app目录下自定义一个文件夹,我用的名字是:Libs 然后直接将phpquery类库扔进这个目录 在c ...

  7. 使用Proguard做Java代码混淆

    下载Proguard, 我下的是最新的Proguad5.2 在windows下运行bin/proguardgui.bat, 可以看见图形界面, 载入配置, 然后process. 配置文件例子 -inj ...

  8. Oracle 11g Express

    Oracle 11g Express 安装和使用教程   使用工具的第一步就是安装工具,配置环境!下面就Oracle 11g Express的安装和简单实用做一简介. 一.下载安装过程 去oracle ...

  9. U3D屏幕空间到世界空间变换

    using UnityEngine; using System.Collections; public class FPSCam : MonoBehaviour { Vector3 lastPos; ...

  10. 基于SignalR的小型IM系统

    这个IM系统真是太轻量级了,提供的功能如下: 1.聊天内容美化 2.用户上下线提示 3.心跳包检测机制 4.加入用户可群聊 下面来一步一步的讲解具体的制作方法. 开篇准备工作 首先,巧妇难为无米之炊, ...