今天写个小东西时,遇到了如下的错误消息:
Consumer closed input channel or an error occurred. events=0x8
Channel is unrecoverably broken and will be disposed!
后来,找到了错误的原因:
public class FileDo {
public void saveToSDCard(String filename,String content) throws Exception{
String path =Environment.getExternalStorageDirectory()+File.separator+"mytxt"+File.separator;
// File file =new File(path);
// if(!file.exists()){
// file.mkdir();
// }
FileOutputStream outStream =new FileOutputStream(path+filename+".txt");
outStream.write(content.getBytes());
outStream.close();
}
}