packetbuffer.java
来自「mysql集群」· Java 代码 · 共 70 行
JAVA
70 行
package com.meidusa.amoeba.net.packet;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
/**
*
* @author struct
*
*/
public interface PacketBuffer {
/**
*
* @return
*/
public ByteBuffer toByteBuffer();
public byte readByte();
public byte readByte(int postion);
public int readBytes(byte[] ab, int offset, int len);
public void reset();
/**
* current remain, but the buffer can expands itself. when the large bytes written;
* @return
*/
int remaining();
/**
*
* @param bte
*/
public void writeByte(byte bte);
/**
*
* @param btes
*/
public int writeBytes(byte[] btes);
/**
*
* @return
*/
public int getPacketLength();
/**
*
* @return
*/
public int getPosition();
/**
* Set the current position to write to/ read from
*
* @param position
* the position (0-based index)
*/
public void setPosition(int positionToSet);
public InputStream asInputStream();
public OutputStream asOutputStream();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?