本文整理了Java中org.apache.sshd.common.util.buffer.Buffer.capacity()
方法的一些代码示例,展示了Buffer.capacity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.capacity()
方法的具体详情如下:
包路径:org.apache.sshd.common.util.buffer.Buffer
类名称:Buffer
方法名:capacity
暂无
代码示例来源:origin: org.apache.sshd/sshd-core
protected Buffer insertCharacter(Buffer org, int c) {
int remaining = org.capacity();
int readPos = org.rpos();
// see if can accommodate the character in the original buffer
if ((remaining > 0) && (readPos > 0)) {
int writePos = org.wpos();
org.wpos(readPos - 1);
org.putByte((byte) c);
org.wpos(writePos);
org.rpos(readPos - 1);
return org;
} else {
Buffer buf = new ByteArrayBuffer(org.available() + Byte.SIZE, false);
buf.putByte((byte) c);
buf.putBuffer(org);
return buf;
}
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
protected Buffer insertCharacter(Buffer org, int c) {
int remaining = org.capacity();
int readPos = org.rpos();
// see if can accommodate the character in the original buffer
if ((remaining > 0) && (readPos > 0)) {
int writePos = org.wpos();
org.wpos(readPos - 1);
org.putByte((byte) c);
org.wpos(writePos);
org.rpos(readPos - 1);
return org;
} else {
Buffer buf = new ByteArrayBuffer(org.available() + Byte.SIZE, false);
buf.putByte((byte) c);
buf.putBuffer(org);
return buf;
}
}
内容来源于网络,如有侵权,请联系作者删除!