OutputStream os = null;
PrintWriter pw = null;
try {
// 현재 시간을 msec으로 구한다.
long now = System.currentTimeMillis();
// 현재 시간을 저장 한다.
Date date = new Date(now);
// 시간 포맷으로 만든다.
SimpleDateFormat sdfNow = new SimpleDateFormat("yy-MM-dd-HH-mm-ss");
String strNowFilename = sdfNow.format(date);
strNowFilename += ".txt";
os = openFileOutput("/mnt/sdcard/World/"+strNowFilename, Context.MODE_PRIVATE);
// Context 에 InputStream 을 반환하는
// openFileInput 메소드.
pw = new PrintWriter(os, true);
// true는 auto flush
String content = mString;
pw.write(content + "\n");
} catch (IOException ie) {
android.util.Log.e("fWriter()", ie.toString());
} finally {
// 잊어서는 안되는 닫기.
try {
if (pw != null) {
pw.close();
}
if (os != null) {
os.close();
}
} catch (IOException ie) {
android.util.Log.e("fWriter()", ie.toString());
}
}
위코드에서 openFileOutput 함수에서 막바로 finally 로 넘어갑니다
sdcard 에 World 란폴더 있습니다
catch (IOException ie) 도 발생하지않고 finally 로 넘어가는걸까요?