fileinput.java~222~

来自「提供了常用的JAVA技术的示例」· JAVA~222~ 代码 · 共 61 行

JAVA~222~
61
字号
package FileInput;import java.io.*;import java.util.*;public class FileInput {    static FileInputStream fis;    static FileOutputStream fos;    static File f,f1;    static byte b[]=new byte[1200];    static byte out[]=new byte[200];    static int I,J;    static String s,o;    static String read="i am a girl";    public static void init()throws IOException{    try{      fis=new FileInputStream("E:\\二厂\\程序\\monitor\\files\\threeAlarm.sql");      fos=new FileOutputStream("e:/h.xml");      //f=new File("1.txt");      //f1=new File("3.txt");    }    catch(FileNotFoundException e){      System.out.println("\n显示信息:"+e.getMessage());    }    try{      I=fis.read(b);    }    catch(IOException e){      System.out.println("\nIO异常:"+e.getMessage());    }    for(int j=0;j<read.length();j++){      fos.write(read.charAt(j));    }    /*for(int i=0;i<180;i++){        fos.write(b[i]);    }*/    s=new String(b);    //o=new String(b);    /*System.out.println("name:"+f.getName());    System.out.println("len="+f.length()+" bytes");    System.out.println("lastModified: "+ (new Date(f1.lastModified())).toString());    System.out.println(f.canWrite()?"canwrite!":"can not writed");    System.out.println("创建新文件?"+(f1.createNewFile()?"cancreat!":"cannot"));    System.out.println("\n-----file: 1.txt 显示!------");*/    System.out.println(s);    //System.out.println("\n---2.txt: copy from 1.txt---");    //System.out.println(o);}public static void main(String a[])throws IOException{    init();  }}

⌨️ 快捷键说明

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