Java communications API ʵÏÖ²¢Ðж˿ڴòÓ¡
ʹÓà Java communications API ʵÏÖ²¢Ðж˿ڴòÓ¡
ÕâÊÇÒ»¸öÔÚ¿Í»§Ö§³ÖÖÐÓöµ½µÄÐÂÎÊÌ⣬ÎÒÔÚÏà¹ØµÄÍøÕ¾([url]www.rxtx.org[/url] and [url]www.sun.com.cn[/url])ÉÏÕÒµ½ÁËһЩÓÐÓõÄÐÅÏ¢£¬×îºóÖÕÓÚÔÚWindows XP ºÍ LinuxIA32 ƽ̨ÏÂʵÏÖ²¢Ðж˿ڴòÓ¡ÕâÒ»¹¦ÄÜ¡£
Ê×ÏÈ£¬ÎÒÃÇÒª´ÓSUNµÄÍøÕ¾ÏÂÔØJava communications API×îеİü(javacomm20-win32.zip)£¬È»ºó½âѹËõÔÚcommapiĿ¼Ï£¬½øÈëcommapiĿ¼ÖУ¬ÎÒÃÇ¿ÉÒÔ¿´µ½win32com.dll£¬comm.jar£¬javax.comm.properties Èý¸öÎļþ¡£ÔÚÕýȷʹÓÃJava communications API֮ǰ£¬ÎÒÃDZØÐëÏÈÅäÖÃJava communications APIÔÚJDK1.4.2ÔËÐл·¾³ÖС£ÎÒÃǼٶ¨JDK1.4.2µÄ°²×°Ä¿Â¼Îª"C:\java142"¡£
1. ¸´ÖÆ win32com.dll µ½ C:\java142\bin
2. ¸´ÖÆ comm.jar µ½ C:\java142\jre\lib\ext
3. ¸´ÖÆ javax.comm.properties µ½ C:\java142\jre\lib£¬javax.comm.properties Ò»¶¨Òª°²×°£¬·ñÔò£¬ÎÒÃǽ«ÕÒ²»µ½ÏµÍ³ÖеÄÈκβ¢Ðж˿ڡ£
ÏÖÔÚ£¬ÎÒÃÇÒѾÍê³ÉÁËcomm.jar µÄ°²×°¹¤×÷£¬¿ÉÒÔ²âÊÔÎÒÃǵijÌÐòÁË¡£ÏÂÃæÎÒ½«¸ø³öÎÒдµÄÒ»¸ö¼òµ¥µÄÀý×Ó£ºSimpleLPTPort.java
---------- BEGIN SOURCE ----------
import java.io.*;
import java.util.*;
import javax.comm.*;
public class SimpleLPTPort {
Enumeration ports;
CommPortIdentifier portId;
ParallelPort LPTPort;
protected OutputStream out;
String outPrintStr = "When an \n\rinput method \n\ris activated, ";
public SimpleLPTPort() {
checkLPTPort();
}
public void checkLPTPort() {
ports = CommPortIdentifier.getPort
Ïà¹ØÎĵµ£º
1¡¢Java.utilµÄ¼¯ºÏÀàÖеÄÔªËرØÐëÊǶÔÏ󻯵ģ¬ËûÃDz»ÄÜÊÇ»ù±¾ÀàÐÍ¡£Èç²»ÄÜÉùÃ÷Set<char>»òList<int>¡£µ«¶ÔList<Integer>£¬¿ÉÒÔÍùÀïÃæ¼ÓintÐÍÊý¾Ý£¬Ëü»áÓÃJavaµÄautoboxing»úÖÆ×Ô¶¯×ª»»³ÉInteger¶ÔÏó¡£
2¡¢²ÎÊý»¯ÀàÖеÄÀàÐͲÎÊý¿ÉÒÔÊÇÊý×éÀàÐÍ£¬ÈçMap< ......
×î½ü¿´µ½Ò»¸öÍøÓѹØÓÚ==ºÍequals ×öµÄ×ܽᣬ·ÖÏíÒ»ÏÂ
javaÖÐequals·½·¨ºÍ“==”µÄÇø±ð£º
equals ·½·¨ÊÇ java.lang.Object ÀàµÄ·½·¨¡£
ÓÐÁ½ÖÖÓ÷¨ËµÃ÷£º
£¨1£©¶ÔÓÚ×Ö·û´®±äÁ¿À´Ëµ£¬Ê¹ÓÓ==”ºÍ“equals()”·½·¨±È½Ï×Ö·û´®Ê±£¬Æä±È½Ï·½·¨²»Í¬¡£
“==”±È½ÏÁ½¸ö±äÁ¿±¾ÉíµÄÖµ£¬¼ ......
·þÎñ¶ËµÄwebservicesµÄ·¢²¼ÊÇ»ùÓÚjax-ws¹æ·¶·¢²¼µÄ¡£ÏÂÃæÊÇ¿Í»§¶Ë¶¯Ì¬µ÷ÓõĴúÂ룬µ÷ÓõÄweb·þÎñÊÇ¿ÉÅäÖõġ£
1£ºÔÚxmlÎĵµÀïÅäÖÃwebservicesµÄwsdlµØÖ·£¬¶Ë¿ÚÃûºÍ²Ù×÷Ãû
2£ºÌṩһ¸ö·½·¨¶ÁÈ¡xmlÎĵµ£¬·µ»ØÒ»¸öList
List list= ReadAndWriteXML.getWebServiceWsdlList();
......
ÓÐ600¸öÆ»¹û£¬10¸öºÐ×Ó£¬ÒªÇó°Ñ600¸öÆ»¹û·Ö×°µ½10¸öºÐ×ÓÀï¡£Èç¹ûÓÐÈËÀ´ÂòÆ»¹ûËæ±ã˵³öÒ»¸öÊý£¬Ö±½ÓÄÃÕâЩºÐ×Ó×éװһϾͿÉÒÔ¸øËû²»Óòð·ÖºÐ×Ó¡£ÇëÎÊÕâ10¸öºÐ×ÓÓ¦¸Ã·Ö±ð×°¶àÉÙÆ»¹û£¿
´úÂëÈçÏÂ
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int box[] = ......