zoukankan      html  css  js  c++  java
  • IO流--进行其他文档输入和输出

      public static void main(String[]args){
    	  FileInputStream fis=null;
    	  FileOutputStream fos=null;
    	  //输入
    	  try {
    		 fis = new FileInputStream("java.txt");
    		 //输出
    		  fos = new FileOutputStream("file"+ File.separator +"login.txt");
    		 //选取字节
    		 byte[]arr=new byte[5];
    		 int temp;
    		 try {
    			 //进行判断,read(arr)字节数量!,只要不等于-1,则显示全部数据
    			while((temp = fis.read(arr)) != -1){
    				 fos.write(arr,0,temp);
    			 }
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	} catch (FileNotFoundException e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    		//单独体
    	}finally {
    		try {
    			//关流
    			fos.close();
    			fis.close();
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	}
    	 
    	 
      }
    

      

  • 相关阅读:
    网口
    uart
    wwww
    ddr相关的配置经验
    嵌入式的指令集和寄存器
    协议栈
    《贝贝GO》服务条款
    《贝贝GO》隐私政策
    《贝贝GO》技术支持
    《王牌助理》隐私政策
  • 原文地址:https://www.cnblogs.com/wsx123/p/13686276.html
Copyright © 2011-2022 走看看