flowdurdistmetric.java

来自「利用Java Socket写的一段通讯协议」· Java 代码 · 共 47 行

JAVA
47
字号
package com.ict.netcom2.metric;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * 流持续时间分布
 * 28 bytes
 */
public class FlowDurDistMetric {
	
	public static final int length = 28;
	
	public int less10s; // 持续时间<=10s的流个数

	public int less30s; // 持续时间在10~30s之间的流个数

	public int less1m; // 持续时间在30s~1m之间的流个数

	public int less2m; // 持续时间在1~2m之间的流个数

	public int less5m; // 持续时间在2~5m之间的流个数

	public int less10m; // 持续时间在5~10m之间的流个数

	public int more10m; // 持续时间10~30m的流个数
	
	public void store(byte[] result) {
		
		if (result.length != length) {
			System.err.println("[FlowDurDistMetric.store()] param len wrong.");
		}
		
		ByteBuffer buf = ByteBuffer.wrap(result);
		buf.order(ByteOrder.LITTLE_ENDIAN);
		
		this.less10s = buf.getInt();
		this.less30s = buf.getInt();
		this.less1m = buf.getInt();
		this.less2m = buf.getInt();
		this.less5m = buf.getInt();
		this.less10m = buf.getInt();
		this.more10m = buf.getInt();
	}

}

⌨️ 快捷键说明

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