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

📄 sotest.java

📁 移动短信网关程序
💻 JAVA
字号:
/*
 * 创建日期 2005-4-30
 *
 * TODO 要更改此生成的文件的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
package com.dog3.prettyBoy;

import java.nio.ByteBuffer;

/**
 * @author Administrator
 *
 * TODO 要更改此生成的类型注释的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */

public class SoTest {
	private ByteBuffer buffer = null;

	//初始函数1
	public SoTest() {
		buffer = ByteBuffer.allocate(Define2.MT_Packet_length);
		buffer.order(Define2.Int_Order);
	}

	//初始函数2
	public SoTest(ByteBuffer byteBuffer1) {
		buffer = byteBuffer1;
		buffer.order(Define2.Int_Order);
	}

	//SET  Id 参数
	public void setID(byte[] protocol) {
		buffer.position(Define2.SoTest_Id_index);
		if (protocol.length >= Define2.SoTest_Id_length) {
			buffer.put(protocol, 0, Define2.SoTest_Id_length);
		} else {
			buffer.put(protocol, 0, protocol.length);
		}
	}

	//	SET  TYPE 参数
	public void setType(byte[] protocol) {
		buffer.position(Define2.SoTest_Type_index);
		if (protocol.length >= Define2.SoTest_Type_length) {
			buffer.put(protocol, 0, Define2.SoTest_Type_length);
		} else {
			buffer.put(protocol, 0, protocol.length);
		}
	}

	//	SET  MT_ThirdPartyID 参数
	public void setResult(byte[] protocol) {
		buffer.position(Define2.SoTest_Result_index);
		if (protocol.length >= Define2.SoTest_Result_length) {
			buffer.put(protocol, 0, Define2.SoTest_Result_length);
		} else {
			buffer.put(protocol, 0, protocol.length);
		}
	}
	
	public ByteBuffer getByteBuffer() {
		return buffer;
	}

	/**
	 *  
	 */
	public void reuse() {
		buffer.clear();
		buffer.position(0);
		for (int i = 0; i < Define2.MT_Packet_length; i++) {
			buffer.put((byte) 0);
		}
		buffer.clear();
	}

}

⌨️ 快捷键说明

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