¹Ø¼ü´Ê¹ýÂËʵÏÖ£¨JAVA TXT£©
http://51jsp.cn/post/23.html
ÏÖÔÚ×öÍøÕ¾Ê×ÏÈ¿¼ÂÇÒ»µã¾ÍÊDz»ÄÜÔÚ×Ô¼ºµÄÍøÕ¾ÖгöÏÖ·Ç·¨µÄ¶«Î÷£¬°üÀ¨Ò»Ð©Ãô¸ÐµÄ´Ê¡£ÏÖÔÚÎÒÃǾÍÀ´¼òµ¥µÄʵÏÖËü£¬ÎªÁ˲éÕҵĿìËÙÔÚÕâÓÃtxtÀ´±£´æÕâЩ·Ç·¨µÄ¹Ø¼ü´Ê¡£Õâ¸öTXTÎĵµÊÇÔÚÍøÉÏÕÒµ½£¬ÏÖÔÚ´«ÉÏÀ´200907261131128065.rar
ÓÃJAVA³ÌÐòʵÏÖ¼òµ¥µÄÌí¼ÓÑéÖ¤¹Ø¼ü´Ê£¬Èç¹û´ó¼ÒҪʵ¼ÊÖÐʹÓã¬Ìí¼Ó²éÕÒËã·¨£¬À´Ìá¸ßËÑË÷Ëٶȡ£
package first;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class keywordsFilter {
/**
* @param args
*/
public String getpath()//»ñµÃ¹ýÂËÎļþ·¾¶
{
return "keywordsFilter.txt";
}
public static boolean checkcontent(String content)//ÑéÖ¤ÊÇ·ñ´æÔڸķǷ¨´Ê
{
keywordsFilter kf = new keywordsFilter();
try {
FileReader reader = new FileReader(kf.getpath());
BufferedReader br = new BufferedReader(reader);
String tempstr="";
while((tempstr=br.readLine())!=null)
{
if(content.contains(tempstr.trim()))
{
return false;
}
}
br.close();
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
public static boolean addkeyword(String keyword)//Ìí¼Ó·Ç·¨´Ê
{
keywordsFilter kf = new keywordsFilter();
if(!checkcontent(keyword))
{
return false;
}
else
{
try {
BufferedWriter bw=new BufferedWriter(new FileWriter(kf.getpath(),true));
String strLine=System.getProperty("line.separator");
bw.append(strLine+keyword);
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
}
public static void main(String [] s)
{
//Ìí¼ÓÒ»¸ö´Ê,Ìí¼Ó֮ǰÎÒÃÇÊ×ÏÈÑéÖ¤Õâ¸ö¹Ø¼ü´ÊÊÇ·ñ´æÔÚ,´æÔÚÌáʾ´æÔÚ,²»´æÔÚÔÙÌí¼Ó
String keywords="²âÊԹؼü´Ê";
if(keywordsFilter.checkcontent(keywords))
{
System.out.println("²»´æÔڸ÷Ƿ¨´Ê:"+keywords);
//È»ºóÌí¼Ó
keywordsFilter.addkeyword(keywords);
}
el
Ïà¹ØÎĵµ£º
ÐòÁл¯¾ÍÊǰѶÔÏóת»»ÎªÁ÷ÒÔ´æ´¢µ½Îļþ»ò´«Êä¸øÁíÒ»¸ö³ÌÐò£»·´ÐòÁл¯¾ÍÊÇ°ÑÁ÷ת»»Îª¶ÔÏó¡£JAVAµÄÐòÁл¯£¬ÊÇͨ¹ýÊÇjava.io.Serializable½Ó¿ÚÀ´ÊµÏֵġ£¸Ã½Ó¿Ú²»°üº¬Èκη½·¨£¬½ö±ê¼ÇÊÇ·ñ¿É±»ÐòÁл¯¡£¿ÉÐòÁл¯µÄÀ࣬Æä³ÉÔ±Ò²±ØÐëÊÇ¿ÉÐòÁл¯µÄ£¨Èç¹ûÓгÉÔ±²»Äܱ»ÐòÁл¯£¬Ôò±ØÐ뽫¸Ã±äÁ¿±ê¼ÇΪ£ºtransient£¨Ë²Ì¬£©£¬ÐòÁл¯Ê±£¬» ......
Ò»¡¢Ê¹ä¯ÀÀÆ÷²»»º´æÒ³ÃæµÄ¹ýÂËÆ÷
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* ÓÃÓÚµÄʹ Browser ²» ......
JavaÊÇÒ»ÖÖÃæÏò¶ÔÏóµÄ±à³ÌÓïÑÔ¡£Ëü¾ßÓÐÓëƽ̨Î޹ء¢ÃæÏò¶ÔÏ󡢶¯Ì¬¡¢°²È«µÈÌص㣬ÔÊÐíÖ±½ÓʹÓöàÏ̷߳½Ê½½øÐбà³Ì£¬¶Ô³ÌÐò½øÐв¢·¢¿ØÖÆ¡£Java»¹Ö§³Ö·Ö²¼Ê½ÍøÂç²Ù×÷£¬´Ó¶øÄܹ»·½±ãµØ½øÐÐÍøÂçÎļþ¶ÔÏóµÄ´æÈ¡¡£ÀûÓÃJavaÓïÑÔ±¾ÉíÌṩµÄ»æͼ¹¦ÄÜ£¬¿ÉÒÔ»æÖÆһЩ¼òµ¥µÄͼÐΡ£¶ø¶ÔÓÚ¸´ÔÓͼÐΣ¬Ò»°ãÏÈÓûæͼÈí¼þÖƳÉͼÏñ£¬È»ºó²ÉÓÃJa ......
¿´ÁËjava˽ÛÓµÄÖм¶ÊÓƵ£¬¸Ð¾õºÜÈ«Ã棬×ܽáÕûÀí³öÁËһЩEclipse¿ì½Ý¼ü£¬Ï£Íû¶ÔÓÐÓõÄÅóÓÑÓÐËù°ïÖú£º
Ctrl+1 ¿ìËÙÐÞ¸´(×î¾µäµÄ¿ì½Ý¼ü,¾Í²»Óöà˵ÁË)
Ctrl+D: ɾ³ýµ±Ç°ÐÐ
Ctrl+Alt+↓ ¸´ÖƵ±Ç°Ðе½ÏÂÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Ctrl+Alt+↑ ¸´ÖƵ±Ç°Ðе½ÉÏÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Alt+↓ µ±Ç°ÐкÍÏÂÃæÒ»Ðн»»¥Î»ÖÃ(Ìرðʵ ......
ÔÚÏÖ´úµÄ²Ù×÷ϵͳÖУ¬ÓÐÒ»¸öºÜÖØÒªµÄ¸ÅÄî¨D¨DỊ̈߳¬¼¸ºõËùÓÐÄ¿Ç°Á÷ÐеIJÙ×÷ϵͳ¶¼Ö§³ÖỊ̈߳¬Ïß³ÌÀ´Ô´ÓÚ²Ù×÷ϵͳÖнø³ÌµÄ¸ÅÄ½ø³ÌÓÐ×Ô¼ºµÄÐéÄâµØÖ·¿Õ¼äÒÔ¼°ÕýÎĶΡ¢Êý¾Ý¶Î¼°¶ÑÕ»£¬¶øÇÒ¸÷×ÔÕ¼Óв»Í¬µÄϵͳ×ÊÔ´£¨ÀýÈçÎļþ¡¢»·¾³±äÁ¿µÈµÈ£©¡£Óë´Ë²»Í¬£¬Ï̲߳»Äܵ¥¶À´æÔÚ£¬ËüÒÀ¸½ÓÚ½ø³Ì£¬Ö»ÄÜÓɽø³ÌÅÉÉú¡£Èç¹ûÒ»¸ö½ø³ÌÅÉÉú³öÁË ......