首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

java IO 读写资料

2012-10-20 
java IO 读写文件public class Test {public static void main(String[] args) throws Throwable {File fi

java IO 读写文件

public class Test {public static void main(String[] args) throws Throwable {File file = new File("C:\\Users\\Administrator\\Desktop\\123.jpg");File file2 = new File("C:\\Users\\Administrator\\Desktop\\123_4.jpg");System.out.println("Started:");InputStream in = new FileInputStream(file);OutputStream out = new FileOutputStream(file2);byte[] tempbytes = new byte[1024];while (in.available() > 0) {int read = in.read(tempbytes, 0, tempbytes.length);System.out.println(read);out.write(tempbytes, 0, read);}out.close();in.close();System.out.println("ended:");}}
?

热点排行