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

📄 sgipabstractstruct.java

📁 联通短信网关SGIP通用java源代码
💻 JAVA
字号:
package com.zzxy.shortmessage.SGIP;

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



public abstract class SGIPAbstractStruct {
    public static final int    STRUCT_MAX_SIZE = 1024 * 4; // 4K
	public Head               head            = null;
	public static final String charset         = "GB2312";
	public final ByteOrder byteOrder =ByteOrder.BIG_ENDIAN;

	public final ByteBuffer getAllBuffer() throws Exception {
	  ByteBuffer buffer = ByteBuffer.allocate(this.getHead().getBuffer().capacity()
	        + this.getBuffer().capacity());
	  buffer.order(byteOrder);
	  buffer.put(this.getHead().getBuffer());
	  buffer.put(this.getBuffer());
	  buffer.flip();
	  
	  return buffer;
	}

	public final void setAllBuffer(ByteBuffer buffer) throws Exception {
	  buffer.order(byteOrder);
	  this.setHead(new Head());
	  this.getHead().setBuffer(buffer);
	  this.setBuffer(buffer);
	}

	public final void setHead(Head head) {
	  this.head = head;
	}

	public final Head getHead() {
	  return head;
	}

	public abstract ByteBuffer getBuffer()throws Exception;
	public abstract void setBuffer(ByteBuffer buffer) throws Exception;
  }

⌨️ 快捷键说明

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