问个JAVA书上的问题,IO流文件复制,求高手解答
importjava.io.*;publicclassAaa{publicstaticvoidmain(String[]ashs)throwsIOException{Fi...
import java.io.*;
public class Aaa{
public static void main(String[] ashs)throws IOException
{
FileInputStream fis=new FileInputStream(ashs[0]);
FileOutputStream fos=new FileOutputStream(ashs[1]);
byte[]buf=new byte[512];
int n=0;
n=fis.read(buf,0,512);
while(n!=-1){
fos.write(buf,0,512);
}fis.close();
fos.close();
}
}
编译后,无限复制图片,请求解答,我是新手
在线等 展开
public class Aaa{
public static void main(String[] ashs)throws IOException
{
FileInputStream fis=new FileInputStream(ashs[0]);
FileOutputStream fos=new FileOutputStream(ashs[1]);
byte[]buf=new byte[512];
int n=0;
n=fis.read(buf,0,512);
while(n!=-1){
fos.write(buf,0,512);
}fis.close();
fos.close();
}
}
编译后,无限复制图片,请求解答,我是新手
在线等 展开
展开全部
import java.io.*;
public class Aaa{
public static void main(String[] ashs)throws IOException
{
FileInputStream fis=new FileInputStream(ashs[0]);
FileOutputStream fos=new FileOutputStream(ashs[1]);
byte[]buf=new byte[512];
int n=0;
do{
n=fis.read(buf,0,512);
fos.write(buf,0,512);
}while(n!=-1)
fis.close();
fos.close();
}
}
public class Aaa{
public static void main(String[] ashs)throws IOException
{
FileInputStream fis=new FileInputStream(ashs[0]);
FileOutputStream fos=new FileOutputStream(ashs[1]);
byte[]buf=new byte[512];
int n=0;
do{
n=fis.read(buf,0,512);
fos.write(buf,0,512);
}while(n!=-1)
fis.close();
fos.close();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询