📄 bussinessinhelper.java
字号:
package com.AUG21.ProtocolEncapsulation;
import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.*;
import static com.AUG21.ProtocolEncapsulation.Config.*;
public class BussinessInHelper {
private ByteBuffer bb;
private int len;
public BussinessInHelper(byte[] buf) {
if (buf != null) {
this.len = buf.length - END_SYMBOL.length();
bb = ByteBuffer.wrap(buf, 0, len);
bb.order(ByteOrder.LITTLE_ENDIAN);
}
}
public String getIP(){
byte[] ip = new byte[8];
for(int i = 0;i<8;i++)ip[i] = bb.get();
String s = ip.toString();
return s;
}
public int getInt() {
return bb.getInt();
}
public long getLong() {
return bb.getLong();
}
public String getString(int length) throws IOException {
byte[] buf = new byte[length];
for (int i = 0; i < length; i++) {
buf[i] = bb.get();
}
return new String(buf, "GBK").trim();
}
public String getString(int length, String encode) throws
IOException {
byte[] buf = new byte[length];
for (int i = 0; i < length; i++) {
buf[i] = bb.get();
}
return new String(buf, encode).trim();
}
public byte getByte() {
return bb.get();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -