⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 romulusnetprotocol.java

📁 《Java案例开发》源代码( 考勤系统的完整实现!) 包括数据库 网络通讯&uml
💻 JAVA
字号:
/* * RomulusNetProtocol.java * * Created on 2004年1月12日, 下午12:58 */package romulus.NET;import java.util.*;import java.io.*;/** * * @author  Administrator * @version */public class RomulusNetProtocol {        //The filename stores Properties    public final static String FileName = "RomulusNet.prop";        //The Property Name for Server's Name    public final static String AppServer = "Romulus Test Application Server";    //The Property Name for Server Address    public final static String AppServerAddr = "Server_Address";    //The Property Name for Server Port    public final static String AppServerPort = "Server_Port";    //The Property Name for Maximum Listening Queue Length    public final static String AppServerQueueLength = "Server_QueueLength";        //The Property Name for Service Commands    public final static String UserCheckCommands = "User Check";    public final static String GetTestCommands = "Get Test";    public final static String GradeTestCommands = "Grade Test";    public final static String GetFullTestCommands = "Get Full Test";        //Commands used in User Check    public final static String UC_ServerAsk = "Check Information Needed";    public final static String UC_ServerRetPass = "Pass";    public final static String UC_ServerRetFail = "Fail";        //Commands used in Get Initial Test and Get Full Test    public final static String GT_ServerAsk = "Pass the TestNumber";        //Commands used in Grade Test    public final static String GDT_ServerAsk = "Pass the TestData";        /** Creates new RomulusNetProtocol */    private RomulusNetProtocol() {    }        //The method to get the properties    public static Properties getRomulusNetProtocolProperties() throws IOException{        Properties ret = new Properties();        FileInputStream in = new FileInputStream(FileName);        ret.load(in);        in.close();        return ret;    }        //get info    //"name|pass|test" to {"name", "pass", "test"}    public static String[] getInfo(String info){        String[] ret = new String[3];                int beg = 0;        int end = info.indexOf('|', beg);        ret[0]= info.substring(beg, end);                beg = end+1;        end = info.indexOf('|', beg);        ret[1]= info.substring(beg, end);                beg = end+1;        ret[2] = info.substring(beg);                return ret;    }        /**     * @param args the command line arguments     */    public static void main(String args[]) {        Properties defaultProps = new Properties();                defaultProps.put(RomulusNetProtocol.AppServer, RomulusNetProtocol.AppServer);        defaultProps.put(RomulusNetProtocol.AppServerAddr, "localhost");        defaultProps.put(RomulusNetProtocol.AppServerPort, "1228");        defaultProps.put(RomulusNetProtocol.AppServerQueueLength, "20");                defaultProps.put(RomulusNetProtocol.UserCheckCommands, RomulusNetProtocol.UserCheckCommands);        defaultProps.put(RomulusNetProtocol.GetFullTestCommands, RomulusNetProtocol.GetFullTestCommands);        defaultProps.put(RomulusNetProtocol.GetTestCommands, RomulusNetProtocol.GetTestCommands);        defaultProps.put(RomulusNetProtocol.GradeTestCommands, RomulusNetProtocol.GradeTestCommands);                defaultProps.put(RomulusNetProtocol.UC_ServerAsk, RomulusNetProtocol.UC_ServerAsk);        defaultProps.put(RomulusNetProtocol.UC_ServerRetFail, RomulusNetProtocol.UC_ServerRetFail);        defaultProps.put(RomulusNetProtocol.UC_ServerRetPass, RomulusNetProtocol.UC_ServerRetPass);                defaultProps.put(RomulusNetProtocol.GT_ServerAsk, RomulusNetProtocol.GT_ServerAsk);                defaultProps.put(RomulusNetProtocol.GDT_ServerAsk, RomulusNetProtocol.GDT_ServerAsk);                defaultProps.list(System.out);                try{            FileOutputStream out = new FileOutputStream(RomulusNetProtocol.FileName);            defaultProps.store(out, "The Properties of Romulus Net Servieces");            out.close();        }        catch(IOException e){            e.printStackTrace();        }    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -