Java提示错误Exception in thread "main" java.io.FileNotFoundException:dest.zip
importjava.io.*;importjava.util.zip.*;publicclassCompress{publicstaticvoidmain(String...
import java.io.*;
import java.util.zip.*;
public class Compress
{
public static void main(String[] args)throws IOException
{
DataInputStream input=new DataInputStream(new FileInputStream("source.txt"));
ZipOutputStream zipoutput=new ZipOutputStream(new FileOutputStream("dest.zip"));
zipoutput.setMethod(ZipOutputStream.DEFLATED);
zipoutput.putNextEntry(new ZipEntry("source.txt"));
DataOutputStream output=new DataOutputStream(zipoutput);
int ch;
while((ch=input.read())!=-1)
{
output.write(ch);
}
output.close();
input.close();
}
}
import java.io.*;
import java.util.zip.*;
public class Release{
public static void main(String[] args)throws IOException{
ZipInputStream zipinput=new ZipInputStream(new FileInputStream("dest.zip"));
zipinput.getNextEntry();
DataInputStream input=new DataInputStream(zipinput);
DataOutputStream output =new DataOutputStream(new FileOutputStream("source1.txt"));
int ch;
while((ch=input.read())!=-1){
output.write(ch);
}
output.close();
input.close();
}
}
求解惑啦~~ 展开
import java.util.zip.*;
public class Compress
{
public static void main(String[] args)throws IOException
{
DataInputStream input=new DataInputStream(new FileInputStream("source.txt"));
ZipOutputStream zipoutput=new ZipOutputStream(new FileOutputStream("dest.zip"));
zipoutput.setMethod(ZipOutputStream.DEFLATED);
zipoutput.putNextEntry(new ZipEntry("source.txt"));
DataOutputStream output=new DataOutputStream(zipoutput);
int ch;
while((ch=input.read())!=-1)
{
output.write(ch);
}
output.close();
input.close();
}
}
import java.io.*;
import java.util.zip.*;
public class Release{
public static void main(String[] args)throws IOException{
ZipInputStream zipinput=new ZipInputStream(new FileInputStream("dest.zip"));
zipinput.getNextEntry();
DataInputStream input=new DataInputStream(zipinput);
DataOutputStream output =new DataOutputStream(new FileOutputStream("source1.txt"));
int ch;
while((ch=input.read())!=-1){
output.write(ch);
}
output.close();
input.close();
}
}
求解惑啦~~ 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询