Resp.java
资源名称:sgip_java.rar [点击查看]
上传用户:leafage163
上传日期:2022-08-08
资源大小:15k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package com.zzxy.shortmessage.SGIP;
- import java.nio.ByteBuffer;
- public class Resp extends SGIPAbstractStruct{
- public byte Result; //1B 0:接收成功;其它: 错误码
- public String Reserve;//8B 保留,扩展用
- public static final int STRUCT_SIZE=9;
- public Resp() {
- Head head = new Head(0);
- head.Msglen=Head.STRUCT_SIZE+this.STRUCT_SIZE;
- this.setHead(head);
- }
- //@Override
- public ByteBuffer getBuffer() {
- ByteBuffer buffer = ByteBuffer.allocate(STRUCT_SIZE);
- buffer.order(byteOrder);
- buffer.put(Result);
- for (int i = 0; i < 8; i++) {
- buffer.put((byte)0);
- }
- buffer.flip();
- return buffer;
- }
- //@Override
- public void setBuffer(ByteBuffer buffer) throws Exception {
- buffer.order(byteOrder);
- Result = buffer.get();
- }
- }