¿¹Á¦

public class ClassA {

public void makeStream (OutputStream oStream) {

try {
ZipOutputStream stream = new ZipOutputStream(oStream);
stream.write(7);
//do something...

stream.close();

}
catch (IOException e) {
//stream leaked...
}
}
}



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


public class ClassA {

public void makeStream (OutputStream oStream) {

ZipOutputStream stream = null;
try {
stream = new ZipOutputStream(oStream);
stream.write(7);
//do something...

}
catch (IOException e) {
//do something...

}
finally {
if (stream != null) {
try {
stream.close();

}
catch(IOException e) {
//do something...

}
}
}
}
}