⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filestringdemo.java

📁 一些基本的java程序源代码
💻 JAVA
字号:
package filestreamdemo;
import java.io.*;
public class FileStringDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try{
			byte[] buffer=new byte[1024];
			FileInputStream fileInputStream=new FileInputStream(new File(args[0]));
			FileOutputStream fileOutputStream=new FileOutputStream(new File(args[1]));
			System.out.println("复制文件:"+fileInputStream.available()+"字节");
			while(true){
				if(fileInputStream.available()<1024){
					int remain=-1;
					while((remain=fileInputStream.read())!=-1){
						fileOutputStream.write(remain);
					}
					break;
				}
				else{
					fileInputStream.read(buffer);
					fileOutputStream.write(buffer);
				}
			}
			fileInputStream.close();
			fileOutputStream.close();
			System.out.println("复制完成");
		}
		catch(ArrayIndexOutOfBoundsException e){
			System.out.println("using:java FileStreamDemo Scr des");
			e.printStackTrace();
		}
		catch(IOException e){
			e.printStackTrace();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -