¿¹Á¦

public class ClassA {

private FileOutputStream stream;

public void makeStream (File file) {

try {
stream = new FileOutputStream(file);
} catch(FileNotFoundException fnfe) {
//perform exception handling
}
//do something...

}
}



¼Ö·ç¼Ç
ÀÚ¿ø ´©¼ö¸¦ ÇÇÇÏ·Á¸é close()°¡ ¸ðµç java.io.FileOutputStream¿¡¼­ È£ÃâµÇ¾ú´ÂÁö È®ÀÎÇϽʽÿÀ. Âü°í: ÀÌ ±ÔÄ¢Àº FileOutputStream »ý¼ºÀÚÀÇ ¸ðµç Çü½Ä¿¡ Àû¿ëµË´Ï´Ù.


public class ClassA {

private FileOutputStream stream;

public void makeStream (File file) {

try {
stream = new FileOutputStream(file);
} catch(FileNotFoundException fnfe) {
//perform exception handling
}
//do something...

try {
stream.close();
} catch(IOException ioe) {
//perform exception handling
}
}
}