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

📄 txtcopy.java

📁 java语言与面向对象程序设计源程序
💻 JAVA
字号:
import java.io.*; 
class Txtcopy 
{   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("请输入源文件名称:\n");
        System.in.read(b1,0,255);
        System.out.println("\n请输入目的文件名称:\n");
        System.in.read(b2,0,255);
 String sourceName=new String(b1,0);
//if (!sourceName.trim().equals(new String("F"))){System.out.println(sourceName);};
 String desName=new String(b2,0);
 FileInputStream fileInput=new FileInputStream(sourceName.trim());
 int bytes1=fileInput.read(b3,0,2056);
 String sourceFile=new String(b3,0,0,bytes1);
 
 FileOutputStream fileOutput=new FileOutputStream(desName.trim());
 fileOutput.write(b3,0,bytes1);
 fileInput=new FileInputStream(desName.trim());
 int bytes2=fileInput.read(b4,0,2056);
 String desFile=new String(b4,0,0,bytes2);
 System.out.println("\n源文件内容为:\n") ;
 System.out.println(sourceFile);
 System.out.println("\n目的文件内容为:\n");
 System.out.println(desFile);
 } 
catch(Exception e)
   { System.out.println(e.toString());}
}
}



⌨️ 快捷键说明

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