文档介绍:.;;;;;;;;;;;.Socket;;;;;;lassDMSClient{privateDMSClientFrameframe;/***用于保存日志文件读取位置*/privateFilepositionFile;/***用readLogs生成的文本日志文件*/privateFiletextLogFile;/***原始的unix日志文件*/privateFilelogFile;publicstaticfinalintLOG_LENGTH=372;publicstaticfinalshortLOGIN=7;publicstaticfinalshortLOGOUT=8;privatePropertiesconfig;privateintbatch;privateFilematchedLogFile;privateFileloginFile;privateStringserverHost;privateintserverPort;/**2*利用构造器初始化对象属性*/publicDMSClient(){//读取配置文件,利用配置文件初始化参数对象config=newProperties();try{(newFileInputStream(""));}catch(IOExceptione){();thrownewRuntimeException(e);}logFile=newFile((""));positionFile=newFile((""));textLogFile=newFile((""));batch=(("batch"));matchedLogFile=newFile((""));loginFile=newFile((""));serverHost=("");serverPort=((""));}publicvoidshowReadLogsMsg(Stringmsg){if(frame==null){(msg);}else{(msg);}}/***读取日志文件*/publicvoidreadLogs(){//要保证在调用readLog()时logFile变量要有适用的对象if(!()){showReadLogsMsg("没有unix日志文件!");return;}if(()){showReadLogsMsg("文本文件存在!本次不读取了!");return;}//读取上回位置判断是否有新记录产生intn=0;//上次读取的记录号Scannerin=null;3if(()){try{in=newScanner(positionFile);n=();showReadLogsMsg("读取本次记录号"+n);}catch(IOExceptione){();showReadLogsMsg("没有读取位置文件,从0读取。");n=0;}finally