?? utility.java
字號:
import java.io.*;
public class Utility{
public static int antNum=5;
public static String url;
public static String defaultDirectory="c:\\download";
public static boolean stop=false;
public static long nStart[]={0l,0l,0l,0l,0l};
public static long nStop[]={0l,0l,0l,0l,0l};
public static long size;
public static int code;
public static boolean bStop[]={false,false,false,false,false};
public Utility(){
url=null;
defaultDirectory=null;
}
public static String getFileName(){
String name;
int index=url.lastIndexOf("/");
name=url.substring(index+1);
return name;
}
public static String getTempFileName(){
String name;
int firstindex=url.lastIndexOf("/");
int lastindex=url.lastIndexOf(".");
name=url.substring(firstindex+1,lastindex);
return name;
}
public static void serializeOut(){
try{
File tempFile=new File(getTempFileName()+"."+"tmp");
FileOutputStream file=new FileOutputStream(tempFile);
ObjectOutputStream serialize=new ObjectOutputStream(file);
for(int i=0;i<5;i++){
serialize.writeObject(String.valueOf(nStart[i]));
serialize.writeObject(String.valueOf(nStop[i]));
}
serialize.flush();
file.close();
serialize.close();
}catch(Exception e){
System.out.println(e.toString());
}
}
public static void deleteTempFile(){
File tempFile=new File(getTempFileName()+"."+"tmp");
tempFile.delete();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -