📄 filetargetimpl.java
字号:
/* * FileTargetImpl.java * * Created on 8. november 2005, 12:08 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package backup.client;import java.rmi.*;import java.rmi.server.UnicastRemoteObject;import java.io.*;/** * * @author Thomas */public class FileTargetImpl extends UnicastRemoteObject implements FileTarget { long bytesTransferred = 0; File file; FileOutputStream out; /** * Creates a new instance of FileTargetImpl */ public FileTargetImpl(File file) throws RemoteException, IOException { this.file = file; out = new FileOutputStream(file); } public int write(byte[] bytes) throws RemoteException { try { if (out != null) { out.write(bytes); bytesTransferred += bytes.length; return bytes.length; } else { out.flush(); return -1; } } catch (Exception e) { e.printStackTrace(); return -1; } } public long getFileSize() { return bytesTransferred; } public void fireFileTransfered() throws RemoteException { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -