如何打印出异常Exception的内容
public static void main(String[] args)
{
try{
TestZip t=new TestZip();
t.zip("c:\\test.zip","c:\\test");
t.unzip("c:\\test.zip","c:\\test2");
}
catch(Exception e){e.printStackTrace(System.out);}
public void zip(String zipFileName,String inputFile)throws Exception{
zip(zipFileName,new File(inputFile));
}
public void zip(String zipFileName,File inputFile)throws Exception{
ZipOutputStream out=new ZipOutputStream(new FileOutputStream(zipFileName));
zip(out,inputFile,"");
System.out.println("zip done");
out.close();
}
http://www.chinaunix.net/jh/26/106061.html
{
try{
TestZip t=new TestZip();
t.zip("c:\\test.zip","c:\\test");
t.unzip("c:\\test.zip","c:\\test2");
}
catch(Exception e){e.printStackTrace(System.out);}
public void zip(String zipFileName,String inputFile)throws Exception{
zip(zipFileName,new File(inputFile));
}
public void zip(String zipFileName,File inputFile)throws Exception{
ZipOutputStream out=new ZipOutputStream(new FileOutputStream(zipFileName));
zip(out,inputFile,"");
System.out.println("zip done");
out.close();
}
http://www.chinaunix.net/jh/26/106061.html
0 Comments:
Post a Comment
<< Home