本文整理了Java中org.glassfish.tyrus.core.Utils.appendBuffers()
方法的一些代码示例,展示了Utils.appendBuffers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.appendBuffers()
方法的具体详情如下:
包路径:org.glassfish.tyrus.core.Utils
类名称:Utils
方法名:appendBuffers
[英]Concatenates two buffers into one. If buffer given as first argument has enough space for putting the other one, it will be done and the original buffer will be returned. Otherwise new buffer will be created.
[中]将两个缓冲区连接为一个缓冲区。如果作为第一个参数给出的缓冲区有足够的空间放置另一个参数,则将执行该操作并返回原始缓冲区。否则将创建新的缓冲区。
代码示例来源:origin: eclipse-ee4j/tyrus
void append(ByteBuffer b) {
if (buffer == null) {
buffer = ByteBuffer.allocate(b.remaining());
buffer.flip();
}
int newSize = buffer.limit() + b.remaining();
buffer = Utils.appendBuffers(buffer, b, newSize, 50);
}
}
代码示例来源:origin: eclipse-ee4j/tyrus
void resize() {
int increment = sslEngine.getSession().getPacketBufferSize();
int newSize = buffer.position() + increment;
ByteBuffer newBuffer = ByteBuffer.allocate(newSize);
buffer.flip();
newBuffer.flip();
buffer = Utils.appendBuffers(newBuffer, buffer, newBuffer.limit(), 50);
buffer.compact();
}
代码示例来源:origin: eclipse-ee4j/tyrus
void appendData(ByteBuffer data) throws ParseException {
if (buffer == null) {
// parser was already destroyed.
return;
}
int responseEndPosition = getEndPosition(data);
if (responseEndPosition == -1) {
checkResponseSize(data);
buffer = Utils.appendBuffers(buffer, data, BUFFER_MAX_SIZE, BUFFER_STEP_SIZE);
return;
}
int limit = data.limit();
data.limit(responseEndPosition + 1);
checkResponseSize(data);
buffer = Utils.appendBuffers(buffer, data, BUFFER_MAX_SIZE, BUFFER_STEP_SIZE);
data.limit(limit);
data.position(responseEndPosition + 1);
complete = true;
}
代码示例来源:origin: eclipse-ee4j/tyrus
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE);
} else {
int newSize = data.remaining();
: roundedSize);
result.flip();
data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);
代码示例来源:origin: org.glassfish.tyrus/tyrus-client
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE);
} else {
int newSize = data.remaining();
: roundedSize);
result.flip();
data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);
代码示例来源:origin: eclipse-ee4j/tyrus
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE);
} else {
int newSize = data.remaining();
ByteBuffer.allocate(roundedSize > incomingBufferSize ? newSize : roundedSize);
result.flip();
data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);
代码示例来源:origin: org.glassfish.tyrus/tyrus-core
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE);
} else {
int newSize = data.remaining();
ByteBuffer.allocate(roundedSize > incomingBufferSize ? newSize : roundedSize);
result.flip();
data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);
内容来源于网络,如有侵权,请联系作者删除!