本文整理了Java中org.apache.sshd.common.util.buffer.Buffer.ensureAvailable()
方法的一些代码示例,展示了Buffer.ensureAvailable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.ensureAvailable()
方法的具体详情如下:
包路径:org.apache.sshd.common.util.buffer.Buffer
类名称:Buffer
方法名:ensureAvailable
[英]Makes sure the buffer contains enough data to accommodate the requested length
[中]确保缓冲区包含足够的数据以容纳请求的长度
代码示例来源:origin: org.apache.sshd/sshd-common
public byte getByte() {
ensureAvailable(Byte.BYTES);
getRawBytes(workBuf, 0, Byte.BYTES);
return workBuf[0];
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
public byte getByte() {
ensureAvailable(Byte.BYTES);
getRawBytes(workBuf, 0, Byte.BYTES);
return workBuf[0];
}
代码示例来源:origin: org.apache.sshd/sshd-common
public short getShort() {
ensureAvailable(Short.BYTES);
getRawBytes(workBuf, 0, Short.BYTES);
short v = (short) ((workBuf[1] << Byte.SIZE) & 0xFF00);
v |= (short) (workBuf[0] & 0xF);
return v;
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
public long getLong() {
ensureAvailable(Long.BYTES);
getRawBytes(workBuf, 0, Long.BYTES);
long l = ((long) workBuf[0] << 56) & 0xff00000000000000L;
l |= ((long) workBuf[1] << 48) & 0x00ff000000000000L;
l |= ((long) workBuf[2] << 40) & 0x0000ff0000000000L;
l |= ((long) workBuf[3] << 32) & 0x000000ff00000000L;
l |= ((long) workBuf[4] << 24) & 0x00000000ff000000L;
l |= ((long) workBuf[5] << 16) & 0x0000000000ff0000L;
l |= ((long) workBuf[6] << 8) & 0x000000000000ff00L;
l |= (workBuf[7]) & 0x00000000000000ffL;
return l;
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
public short getShort() {
ensureAvailable(Short.BYTES);
getRawBytes(workBuf, 0, Short.BYTES);
short v = (short) ((workBuf[1] << Byte.SIZE) & 0xFF00);
v |= (short) (workBuf[0] & 0xF);
return v;
}
代码示例来源:origin: org.apache.sshd/sshd-common
public long getLong() {
ensureAvailable(Long.BYTES);
getRawBytes(workBuf, 0, Long.BYTES);
long l = ((long) workBuf[0] << 56) & 0xff00000000000000L;
l |= ((long) workBuf[1] << 48) & 0x00ff000000000000L;
l |= ((long) workBuf[2] << 40) & 0x0000ff0000000000L;
l |= ((long) workBuf[3] << 32) & 0x000000ff00000000L;
l |= ((long) workBuf[4] << 24) & 0x00000000ff000000L;
l |= ((long) workBuf[5] << 16) & 0x0000000000ff0000L;
l |= ((long) workBuf[6] << 8) & 0x000000000000ff00L;
l |= (workBuf[7]) & 0x00000000000000ffL;
return l;
}
代码示例来源:origin: org.apache.sshd/sshd-common
public long getUInt() {
ensureAvailable(Integer.BYTES);
getRawBytes(workBuf, 0, Integer.BYTES);
return BufferUtils.getUInt(workBuf, 0, Integer.BYTES);
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
public long getUInt() {
ensureAvailable(Integer.BYTES);
getRawBytes(workBuf, 0, Integer.BYTES);
return BufferUtils.getUInt(workBuf, 0, Integer.BYTES);
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
public byte[] getBytes() {
int reqLen = getInt();
int len = ensureAvailable(reqLen);
byte[] b = new byte[len];
getRawBytes(b);
return b;
}
代码示例来源:origin: org.apache.sshd/sshd-common
public byte[] getBytes() {
int len = getInt();
if (len < 0) {
throw new BufferException("Bad item length: " + len);
}
ensureAvailable(len);
byte[] b = new byte[len];
getRawBytes(b);
return b;
}
内容来源于网络,如有侵权,请联系作者删除!