안녕하세요 아즈라엘 입니다. 


파일 IO 를 하는 부분에서 파일을 읽고 쓰고 지우는 과정을 합니다.


파일을 지우게 되므로 다시 In/Out Stream 을 생성시켜야 하는데 

루프문에서 계속 하거든요..


그래서 


try {

if (dos != null) {

dos.close();

dos = null;

dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(new File(recordingFile))));

}

} catch (IOException e) {


} catch (NullPointerException e) {



이렇게 null 문자로 넣어주어 GC 에게 위임을 하고 새로 new 했더니 안되더군요..


그리하여 


dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(new File(recordingFile))));


부분을 다른 메서드에서 하니 되는겁니다.


즉 


try {

if (dos != null) {

dos.close();

dos = null;

}

} catch (IOException e) {


} catch (NullPointerException e) {


}


여기 까지만 한 메서드에서 하고 


나머지 부분은 다음 메서드에서 


if(dos == null){

dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(new File(recordingFile))));

}


이렇게 해서 처리 하니 되네요..


혹시 이런 경험 있으신가요?