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

📄 utility.java

📁 网络蚂蚁Java版
💻 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 + -