android开发中的文件操作
2010-08-20 02:01:00 来源:WEB开发网核心提示:*/public String read(String fileName) throws Exception {FileInputStream fileInputStream = this.context.openFileInput(fileName);ByteArrayOutputStream byteArray =
*/
public String read(String fileName) throws Exception {
FileInputStream fileInputStream = this.context.openFileInput(fileName);
ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = fileInputStream.read(buffer)) > 0) {
byteArray.write(buffer, 0, len);
};
return byteArray.toString();
}
}
更多精彩
赞助商链接