List<String> outList = new ArrayList<String>();
OutputStream fOut = null;
try {
fOut = new FileOutputStream(new File("D:/test.txt"));
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
for(String Str:outList){
fOut.write((Str+"\n").getBytes());
catch (IOException e) {
if(fOut != null){
fOut.close();
List<String> outList = new ArrayList<String>();
OutputStream fOut = null;
try {
fOut = new FileOutputStream(new File("D:/test.txt"));
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for(String Str:outList){
try {
fOut.write((Str+"\n").getBytes());
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(fOut != null){
try {
fOut.close();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}