android file path
问题 出现的异常为: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的更多相关文章
- 安卓各文件存储路径汇总(Android file path)
		写下来,省得以后不记得到处翻: Environment.getDataDirectory() = /data Environment.getDownloadCacheDirectory() = /ca ... 
- 《ArcGIS Runtime SDK for Android开发笔记》——问题集:Error:Error: File path too long on Windows, keep below 240 characters
		1.前言 在使用Android Studio开发环境时,经常会爆出以下错误,虽然具体细节内容各有不同,但是说明的都是同一个问题,在windows中使用过长的路径,超过240字符. Error:Erro ... 
- 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, ... 
- [LeetCode] Longest Absolute File Path 最长的绝对文件路径
		Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsub ... 
- Android中Path类的lineTo方法和quadTo方法画线的区别
		转载:http://blog.csdn.net/stevenhu_223/article/details/9229337 当我们需要在屏幕上形成画线时,Path类的应用是必不可少的,而Path类的li ... 
- Longest Absolute File Path
		Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsub ... 
- android 利用Path.cubicTo 画 贝塞尔曲线
		Path.cubicTo void android.graphics.Path.cubicTo(float x1, float y1, float x2, float y2, float x3, fl ... 
- OS X 禁止Android File Transfer自动启动
		操作步骤 关闭Android File Manager 在Activity Manager中退出Android File Manager Agent进程 在Applications中,将Android ... 
- Leetcode: Longest Absolute File Path
		Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsub ... 
随机推荐
- 《大转换》,计算会像电力一样变成基础设施,基本是作者10年前写的《IT不再重要》的修订版,3星。
			本书英文版是2014年出的,基本是作者2004年的<IT不再重要>的修订版,还是在说<IT不再重要>的那个主题:计算会想电力一样变成技术设施,只需要按需购买. 以下是书中一些观 ... 
- MMORPG大型游戏设计与开发(客户端架构 part4 of vegine)
			昨天是七夕,祝大家都过的快乐,希望这句迟到的问候不会造成大家心中的困扰.这一节讲到了前端比较重要的模块,性能以及调试异常模块.一个应用的性能往往是最核心的部分,就像人身体的各个器官一样,一小部分也不能 ... 
- Eclipse 各种小图标的含义
			Eclipse的Package Explorer和Outline中用图标表示了很多内容,其实能看懂这些图标在编程中也是很有用的. 绿色的小圆表示公有类型:如果是实心的就是函数(),如果是圈就表示是变量 ... 
- 【2016-10-13】【坚持学习】【Day4】【模板方法模式】
			今天学习模板方法模式 例子代码; 模板抽象类,定义了一套流程,有一些方法已经实现,有一些抽象方法需要继承它的子类实现 abstract class DataViewer { //抽象方法:获取数据 p ... 
- C++11 之 delete 和 default
			1 特殊成员函数 设计一个类,没有成员函数 (member function),只有数据成员 (member data) class DataOnly { private: std::string ... 
- AC日记——计算2的N次方 openjudge 1.6 12
			12:计算2的N次方 总时间限制: 1000ms 内存限制: 65536kB 描述 任意给定一个正整数N(N<=100),计算2的n次方的值. 输入 输入一个正整数N. 输出 输出2的N次方 ... 
- 渗透中Necat的另类用法
			Necat 是一个伟大而实用的用于 TCP 和 UPD 网络连接协议的读写程序.同时 Necat 也被誉为网络中的瑞士军刀,在许多黑客教程中 Necat 也被广泛使用.Necat 最常见用途是设置反向 ... 
- 【转】TestFlight APP测试(IOS如何让上架前给其他人测试)
			原文网址:http://blog.csdn.net/dexin5195/article/details/43966571 大家都知道, 以前iOS项目要测试只需要上传到testflightapp.co ... 
- Exploit利用学习1:MS09-001
			目标 IP: Kali系统IP: 1.使用Metasploit框架,在kali终端输入msfconsole打开Metasploit:如下图 2.搜索相关模块:search ms09-001 找到一个可 ... 
- PAT 1012. 数字分类 (20)
			给定一系列正整数,请按要求对数字进行分类,并输出以下5个数字: A1 = 能被5整除的数字中所有偶数的和: A2 = 将被5除后余1的数字按给出顺序进行交错求和,即计算n1-n2+n3-n4...: ... 
