本文整理了Java中org.glassfish.grizzly.Buffer.shrink()
方法的一些代码示例,展示了Buffer.shrink()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.shrink()
方法的具体详情如下:
包路径:org.glassfish.grizzly.Buffer
类名称:Buffer
方法名:shrink
[英]Disposes the buffer part, outside [position, limit] interval if possible. May return without changing capacity. After shrink is called, position/limit/capacity values may have different values, than before, but still point to the same Buffer elements.
[中]如果可能,在[位置,限制]间隔之外处理缓冲部件。可以在不改变容量的情况下返回。调用shrink后,位置/限制/容量值可能具有与之前不同的值,但仍然指向相同的缓冲区元素。
代码示例来源:origin: org.glassfish.shoal/shoal-gms-impl
@Override
public void shrink() {
grizzlyBuffer.shrink();
}
代码示例来源:origin: org.shoal/shoal-gms-impl
@Override
public void shrink() {
grizzlyBuffer.shrink();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/**
* {@inheritDoc}
*/
@Override
final public double readDouble() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 8) {
final double result = buffer.getDouble();
buffer.shrink();
return result;
}
}
return Double.longBitsToDouble(readLong());
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
final public double readDouble() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 8) {
final double result = buffer.getDouble();
buffer.shrink();
return result;
}
}
return Double.longBitsToDouble(readLong());
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
final public double readDouble() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 8) {
final double result = buffer.getDouble();
buffer.shrink();
return result;
}
}
return Double.longBitsToDouble(readLong());
}
代码示例来源:origin: javaee/grizzly
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: javaee/grizzly
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: javaee/grizzly
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: javaee/grizzly
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http2
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: javaee/grizzly
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: javaee/grizzly
private boolean skip(final FrameParsingState parsingState,
final Buffer message) {
final int bytesToSkip = parsingState.bytesToSkip();
final int dec = Math.min(bytesToSkip, message.remaining());
parsingState.bytesToSkip(bytesToSkip - dec);
message.position(message.position() + dec);
if (message.hasRemaining()) {
message.shrink();
return true;
}
message.tryDispose();
return false;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/**
* {@inheritDoc}
*/
@Override
public long readLong() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 8) {
final long result = buffer.getLong();
buffer.shrink();
return result;
}
}
return (readInt() & 0xffffffffL) << 32 | readInt() & 0xffffffffL;
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public char readChar() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 2) {
final char result = buffer.getChar();
buffer.shrink();
return result;
}
}
return (char) ((readByte() & 0xff) << 8 | readByte() & 0xff);
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public short readShort() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 2) {
final short result = buffer.getShort();
buffer.shrink();
return result;
}
}
return (short) ((readByte() & 0xff) << 8 | readByte() & 0xff);
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public char readChar() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 2) {
final char result = buffer.getChar();
buffer.shrink();
return result;
}
}
return (char) ((readByte() & 0xff) << 8 | readByte() & 0xff);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
/**
* {@inheritDoc}
*/
@Override
public long readLong() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 8) {
final long result = buffer.getLong();
buffer.shrink();
return result;
}
}
return (readInt() & 0xffffffffL) << 32 | readInt() & 0xffffffffL;
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public char readChar() throws IOException {
if (input.isBuffered()) {
final Buffer buffer = input.getBuffer();
if (buffer != null && buffer.remaining() >= 2) {
final char result = buffer.getChar();
buffer.shrink();
return result;
}
}
return (char) ((readByte() & 0xff) << 8 | readByte() & 0xff);
}
内容来源于网络,如有侵权,请联系作者删除!