textcopy.java

来自「内涵了200个适合Java初学者学习的小程序」· Java 代码 · 共 46 行

JAVA
46
字号
import java.lang.*;
import java.io.*;


public class TextCopy extends Object
{


/*
method:       main
params:
              1. String[] args
return type:  void
create time:  2004-08-25 23:20:52
author:       litertiger
*/
public  static void main(String[] args)
{
 byte[] b1=new byte[255];
 byte[] b2=new byte[255];
 byte[] b3=new byte[2056];
 byte[] b4=new byte[2056];
 
 try{
    System.out.println("input the name:\n");
    System.in.read(b1,0,255);
    System.out.println("please input the destination\n");
    System.in.read(b2,0,255);
    String sourceName=new String (b1,0);
    String desName=new String (b2,0);
    FileInputStream fileInput=new FileInputStream(sourceName);
    int byte1=fileInput.read(b3.0,2056);
    FileOnputStream fileOutput=new FileOnputStream(desName);
    Fileoutput.write(b3,0,bytes1);
    fileInput=new FileInputStream(desName);
    String desFile=new String(b4,0,0,bytes2);
    System.out.println("源文件的内容是:\n");
    System.out.println(desFile);
}
catch(Exception e)
{System.out.println(e.toString());
}
}
}

⌨️ 快捷键说明

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