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

📄 fileimpl.java

📁 JAVA开发的采用RMI远程机制
💻 JAVA
字号:
package ftp;

import java.rmi.*;
import java.rmi.server.*;
import java.io.*;

public class fileImpl extends UnicastRemoteObject implements fileinterface
{
    String currdir = null;	
   
   public fileImpl() throws RemoteException
   {
      super(); 	
      currdir="."; 
   }	

   public void setDir(String dir)
   {
   	
     this.currdir = dir;
   }

   public String getDir()
   {
   	 return this.currdir;
   }

   public String[] getCurrFileNames()
   {
   	  File ff = new File(this.getDir());
       return ff.list();
         
   }

   public File downLoad(String filename)
   {
   	 
     File file = new File(this.getDir()+"\\"+filename);	
      return file;	      // the downloade  file
      
   } 
  
   public void upLoad(String filename,byte[] bb)
   {
      try{
      	  File ff = new File("e:\\uploade\\"+filename);	
         // recivere Uploaded the file to Store there   
          if(!ff.exists())
           ff.createNewFile();
          
          FileOutputStream fout = new FileOutputStream(ff);
          fout.write(bb,0,bb.length);     //wirte file from arry bb to e:\\uploade
         
         }
   
      catch(Exception e1)
        {
          System.out.println(e1);	
        }
  
   }
  

}

⌨️ 快捷键说明

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