Using the byte Stream
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyBytes{
public static void main(String[]arr) throws IOException
{
FileInputStream in=null;
FileOutputStream out=null;
try{
in=new FileInputStream("abc.txt");
out=new FileOutputStream("outagain.txt");
int c;
while((c=in.read())!=-1)
{
out.write(c);
}
}finally{
if(in!=null){
in.close();
}
if(out!=null){
out.close();
}
}
}
}
0 comments:
Post a Comment