ÌáÈ¡ÍøÒ³µÄͼƬÁ´½ÓµÄJava³ÌÐò
ÊäÈëÍøÒ³ÎļþÃû£¬ºÍ×ÊÔ´ÁбíÎļþÃû
Êä³ö×ÊÔ´ÁбíÎļþ¹©Ñ¸À×ÏÂÔØ¡£
ÊÊÓÃÓÚÅúÁ¿ÏÂÔØͼƬ¡£
ÓÉÁ½¸öÎļþ×é³É¡£
ûÓÐÌṩÍøÒ³ÏÂÔع¦ÄÜ£¬ÒòΪÎÒûÓÐʱ¼äд£¬Ïà¹ØµÄ´úÂëÒÔºóÔÙÌù¡£
1
//
AnalizeIMG.java
2
3
//
Ö÷³ÌÐò
4
5
import
java.io.BufferedReader;
6
import
java.io.File;
7
import
java.io.FileReader;
8
import
java.io.FileWriter;
9
import
java.io.IOException;
10
11
12
public
class
AnalizeIMG
{
13
14
public
void
p(String s)
15
{
16
System.out.println(s);
17
}
18
19
public
void
analizeFile(String infile,String outfile)
throws
Exception
20
{
21
File file
=
new
File(infile);
22
if
(file
==
null
||
!
file.exists())
{
23
p(
"
File
"
+
infile
+
"
not exits !
"
);
24
}
25
26
if
(
!
file.canRead())
{
27
p(
"
File
"
+
infile
+
"
can't read !
"
);
28
29
}
30
31
String strLine
=
null
;
32
FileReader frd
=
new
FileReader(infile);
33
BufferedReader bufferedReader
=
new
BufferedReader(frd);
34
try
{
35
AnalizeWebParse parse
=
new
AnalizeWebParse();
36
String s
=
parse.parse(bufferedReader);
37
38
createFile(outfile,s);
39
40
Ïà¹ØÎĵµ£º
ÓÐÁ½ÖÖʵÏÖ·½·¨£¬·Ö±ðÊǼ̳ÐThreadÀàÓëʵÏÖRunnable½Ó¿Ú
ÓÃsynchronized¹Ø¼ü×ÖÐÞÊÎͬ²½·½·¨
·´¶ÔʹÓÃstop()£¬ÊÇÒòΪËü²»°²È«¡£Ëü»á½â³ýÓÉÏ̻߳ñÈ¡µÄËùÓÐËø¶¨£¬¶øÇÒÈç¹û¶ÔÏó´¦ÓÚÒ»ÖÖ²»Á¬¹á״̬£¬ÄÇôÆäËûÏß³ÌÄÜÔÚÄÇÖÖ״̬ϼì²éºÍÐÞ¸ÄËüÃÇ¡£½á¹ûºÜÄѼì²é³öÕæÕýµÄÎÊÌâËùÔÚ¡£suspend()·½·¨ÈÝÒ×·¢ÉúËÀËø¡£µ÷ÓÃsuspend()µÄʱºò ......
Ò»°ã¶øÑÔ£¬¿ª·¢ÕßÉçȺ˵µ½¶¯Ì¬ÓïÑÔ£¬´óÖÂÈÏͬµÄÒ»¸ö¶¨ÒåÊÇ£º“³ÌÐòÔËÐÐʱ£¬ÔËÐиıä³ÌÐò½á¹¹»ò±äÁ¿ÀàÐÍ£¬ÕâÖÖÓïÑÔ³ÆΪ¶¯Ì¬ÓïÑÔ”¡£´ÓÕâ¸ö¹Ûµã¿´£¬perl,phthon,rubyÊǶ¯Ì¬ÓïÑÔ£¬C++,JAVA,C#²»ÊǶ¯Ì¬ÓïÑÔ¡£
ÔÚJavaÔËÐÐʱ»·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ ......
ÊÂÎñµÄÌØÐÔ£º
1) Ô×ÓÐÔ£¨atomicity£©£ºÊÂÎñÊÇÊý¾Ý¿âµÄÂß¼¹¤×÷µ¥Î»£¬¶øÇÒÊDZØÐëÊÇÔ×Ó¹¤×÷µ¥Î»£¬¶ÔÓÚÆäÊý¾ÝÐ޸ģ¬ÒªÃ´È«²¿Ö´ÐУ¬ÒªÃ´È«²¿²»Ö´ÐС£
2) Ò»ÖÂÐÔ£¨consistency£©£ºÊÂÎñÔÚÍê³Éʱ£¬±ØÐëÊÇËùÓеÄÊý¾Ý¶¼±£³ÖÒ»ÖÂ״̬¡£ÔÚÏà¹ØÊý¾Ý¿âÖУ¬ËùÓйæÔò¶¼±ØÐëÓ¦ÓÃÓÚÊÂÎñµÄÐ޸ģ¬ÒÔ±£³ÖËùÓÐÊý¾ÝµÄÍêÕûÐÔ¡£
3)&n ......
JavaÔÚ²»Í¬»·¾³Ï»ñÈ¡µ±Ç°Â·¾¶µÄ·½·¨
¹Ø¼ü×Ö: javaÔÚ²»Í¬»·¾³Ï»ñÈ¡µ±Ç°Â·¾¶µÄ·½·¨
1. ÔÚServlet\FilterµÈServlet web»·¾³ÖУ¬Ö»Òª»ñµÃjavax.servlet.ServletContextÀàÐÍ£¬Ôò¿ÉÒÔͨ¹ý getRealPath("...") »ñµÃ·¾¶¡£Ïà¶Ô·¾¶ÖÐ×²ãĿ¼¿Éͨ¹ý²ÎÊý“"/"”»ñÈ¡¡£
request.getSession().getServletContext() ......
×÷ΪJava³ÌÐòÔ±À´Ëµ£¬×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ¿ÉÒÔÑ¡ÔñµÄ·¶Î§Ì«¹ã£¬¿ÉÒÔ¶ÁµÄÊéÌ«¶à£¬ÍùÍùÈÝÒ×ÎÞËùÊÊ´Ó¡£ÎÒÏë¾ÍÎÒ×Ô¼º¶Á¹ýµÄ¼¼ÊõÊé¼®ÖÐÌôÑ¡³öÀ´Ò»Ð©£¬°´ÕÕѧϰµÄÏȺó˳Ðò£¬ÍƼö¸ø´ó¼Ò£¬ÌرðÊÇÄÇЩÏë²»¶ÏÌá¸ß×Ô¼º¼¼ÊõˮƽµÄJava³ÌÐòÔ±ÃÇ¡£
Ò»¡¢Java±à³ÌÈëÃÅÀà
¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄ³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé¼®¶¼Ò»Ñù£¬Õâ ......