fileserverimpl.java
来自「This an example showing how idl helping 」· Java 代码 · 共 42 行
JAVA
42 行
package Data;
import java.io.*;
import Data.FileAccessPOA;
public class FileServerImpl extends FileAccessPOA{
private String filename;
public FileServerImpl(){
super();
filename = "";
}
public String filename(){
return filename;
}
public void filename (String filename){
this.filename = filename;
}
public byte[] get(String filename) throws Data.FileNotFound{
File file = new File(filename);
//DataInputStream myFile = new DataInputStream ( new FileInputStream(new File(filename)));
if(!(file.exists()))
throw new Data.FileNotFound("File Not Found");
long length = file.length();
byte word [] = new byte [(int)length];
try{
DataInputStream myFile = new DataInputStream ( new FileInputStream(new File(filename)));
int i=0;
try{
while(true){
word[i] = myFile.readByte();
i++;
}
}catch (IOException e) { //
}
}catch (FileNotFoundException e) {}
return word;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?