·ÖÏíjavaдµÄµç¿ÏÂÔØÍê³É¹Ø»úС³ÌÐò
×Ô¼ºÑо¿ÏÂverycdÏÂÔØÌ×·,·¢ÏÖÒ»¸ödownloads.txtÎļþͬ²½ÕýÔÚÏÂÔصÄ×ÊÔ´ÐÅÏ¢,ÏÂÔØÍê³Éºó×Ô¶¯É¾³ýÀïÃæµÄ¼Ç¼,Õâ¾Í¼òµ¥¶àÁË.
˼·:¶Ádownloads.txtÎļþ,ÀûÓùؼü×Ö°ÑÀïÃæµÄ¼Ç¼·Ö¸îºó¼ÓÈëlist,Ñ¡Ôñ¼àÊÓµÄÎļþÃû,ÀûÓÃwhileÑ»·µÄµ¹¼Æʱ·½·¨ÒÔÎļþÃûΪ¹Ø¼ü×Ö´ÓlistÀﶨʱËÑË÷,Èç¹ûÏÂÔØÍê³É,µ÷ÓÃruntimeÀàÔËÐÐdosÃüÁîshutdown,Ö´Ðйػú.´úÂëÈçÏÂ:
Java code
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
/**
* @author Y 2010/04/01 23:39
*/
public class ShutDown {
// easyMuleÏÂdownloads.txtÎļþµÄ·¾¶
public static final String FILEPATH = “D:\\Program Files\\easyMule\\downloads.txt”;
// ²éÕÒÏÂÔؼǼÊýµÄ¹Ø¼ü×Ö
public static final String KEYWORD = “ed2k://|file|”;
// ˢжÁÈëdownloads.txtµÄʱ¼ä(Ãë)
int second = 5;
// ÏÂÔØÍê³Éºó¹Ø»úµÄÑÓ³Ùʱ¼ä(Ãë)
int times = 5000;
// ÐèÒª¼àÊÓµÄÎļþidºÅ
int id;
// ¼àÊÓµÄÎļþÃû³Æ
String fileName;
public ShutDown() {
System.out.println(“µ±Ç°µÄÏÂÔØÎļþÐÅϢΪ:”);
System.out
.println(“————————————————————–”);
showFile(readText(FILEPATH, KEYWORD));
System.out
.println(“————————————————————–”);
System.out.println(“ÒªµÈÄĸöÎļþÏÂÔØÍê³É¹Ø±Õ¼ÆËã»ú?”);
Scanner scan = new Scanner(System.in);
id = scan.nextInt() – 1;
fileName = (String) readT
Ïà¹ØÎĵµ£º
ö¾ÙÀàÐÍÊÇJDK5.0µÄÐÂÌØÕ÷¡£SunÒý½øÁËÒ»¸öȫеĹؼü×ÖenumÀ´¶¨ÒåÒ»¸öö¾ÙÀà¡£ÏÂÃæ¾ÍÊÇÒ»¸öµäÐÍö¾ÙÀàÐ͵Ķ¨Ò壺
¡¡¡¡Java´úÂë
¡¡¡¡public enum Color{
¡¡¡¡RED,BLUE,BLACK,YELLOW,GREEN
¡¡¡¡}
¡¡¡¡public enum Color{
¡¡¡¡RED,BLUE,BLACK,YELLOW,GREEN
}
ö¾ ......
ÈçºÎÓÃJAVA ¶ÔÏó£¿
д¼òµ¥Ï¸øÎÒ¿´Ï ллÁË
´´½¨Àà Ãû×Ö =new ÉèString ¼¸¸ö¶¼¿ÉÒÔ¡£ ÔÚÓø´ÖÆ Êä³ö
ÔÚÏÂÃæ¼ÌÐø´´½¨Àà ºóÃæ×îºÃ±ê×¢ÉÏ//ÕâÑù¿´ÆðÀ´¼òµ¥ÏÂллÁË
Çó½â¾ö ÀàºÍ¶ÔÏóûѧÃ÷°×ÀÏʦ½²µÄÎÒºýÍ¿ ÃÔºý×ö²»³öÀ´¡£ ......
²»Óò»ÖªµÀ,Ò»ÓòÅÖªµÀÕâÁ½ÕßÊDz»´óÒ»ÑùµÄ,ÏñÔÚjavaÖÐ,ÊÇÖ±½ÓʹÓà ,Èç str1.replace("$","*") °Ñ$ºÅ±ä³É*ºÅ
µ«ÔÚjavascript¾Í²»Ò»Ñù,ҪʵÏÖÉÏÃæµÄ¹¦ÄÜÊÇÕâÑùд: str.replace(/&/g,"*") ÆäÖеÄgÊDzÎÊý,˵Ã÷Òª½«È«²¿µÄ$¶¼±ä³É*
ÏÂÃæ°ÑjavascriptµÄÕ³ÌùÔÚÏÂÃæ:
¶¨ÒåºÍÓ÷¨
replace() ·½·¨ÓÃÓÚÔÚ×Ö·û´®ÖÐÓÃһЩ×Ö·ûÌ ......
ÈçºÎÓÃJAVA ¶ÔÏó£¿
д¼òµ¥Ï¸øÎÒ¿´Ï ллÁË
´´½¨Àà Ãû×Ö =new ÉèString ¼¸¸ö¶¼¿ÉÒÔ¡£ ÔÚÓø´ÖÆ Êä³ö
ÔÚÏÂÃæ¼ÌÐø´´½¨Àà ºóÃæ×îºÃ±ê×¢ÉÏ//ÕâÑù¿´ÆðÀ´¼òµ¥ÏÂллÁË
Çó½â¾ö ÀàºÍ¶ÔÏóûѧÃ÷°×ÀÏʦ½²µÄÎÒºýÍ¿ ÃÔºý×ö²»³öÀ´¡£ ......