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

📄 dbyh.java

📁 JAVA实现的SOCKET通讯源码,里面有双方制定的报文标示!
💻 JAVA
字号:
package testDzjs.yhServer.appInstance;

import common.ConstPar;

import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;


/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2005-4-16
 * Time: 21:20:41
 * To change this template use File | Settings | File Templates.
 */
public class DbYh extends ConstPar{

    public static ArrayList nshList = null;

    private String startTime = "";

    private String endTime = "";
    static DbYh db = null;
    public static long threadCount = 0;
    public static long receiveCount = 0;
    public static int ai = 0;
    public static long sendCount = 0;

    public static long errCount = 0;

    public static long succCount = 0;
    public synchronized static DbYh getInstance() {
        if(db == null){
            db = new DbYh();
        }
        return db;
    }

    public long getXh(){
        return threadCount++;
    }

    public void receiveCount(){
        receiveCount ++;
    }

    public long getReceiveCount(){
        return receiveCount;
    }

    public void setStartTime(String startTime){
        this.startTime = startTime;
    }

    public void setEndTime(String endTime){
        this.endTime = endTime;
    }

    public long getCountTime(){
        return (Long.parseLong(getEndTime()) - Long.parseLong(getStartTime()));
    }

    public String getStartTime(){
        return this.startTime;
    }

    public String getEndTime(){
        return this.endTime;
    }

    public void sendCount(){
        ai ++;
        sendCount ++;
    }

    public void errCount(){
        errCount ++;
    }

    public void succCount(){
        succCount ++;
    }

    public long getSendCount(){
        return sendCount;
    }

    public long getErrCount(){
        return errCount;
    }

    public long getSuccCount(){
        return succCount;
    }

    public void setNshList(){
        nshList = nshRead();
    }

    public String getNshData(){
        if( ai >= nshList.size()  ) ai = ai - 1;
        return nshList.get(ai).toString();
    }

    ArrayList nshRead(){
        String filename = DHDZJSDATAFILENAME;
        ArrayList al = new ArrayList();
        try{
            BufferedReader br = new BufferedReader(new FileReader(new File(filename)));
            while(br.ready()){
                al.add(br.readLine());
            }
            br.close();
        }catch(Exception e){
            e.printStackTrace();
        }
        return al;
    }
}

⌨️ 快捷键说明

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