FileInputStram/FileOutputStream的实例

作者在 2010-05-21 14:13:57 发布以下内容
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyFile{
    public static void main(String[] args) {
        try {
            FileInputStream fis = new FileInputStream ("a.jpg");//本地中存在的文件
            FileOutputStream fos = new FileOutputStream ("temp.jpg");
            int read = fis.read();        
            while ( read != -1 ) {
                fos.write(read);    
                read = fis.read();
            }            
            fis.close();
            fos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
I/O编 | 阅读 903 次
文章评论,共0条
游客请输入验证码
浏览290912次