org.glassfish.grizzly.Buffer.hasRemaining()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.glassfish.grizzly.Buffer.hasRemaining()方法的一些代码示例,展示了Buffer.hasRemaining()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.hasRemaining()方法的具体详情如下:
包路径:org.glassfish.grizzly.Buffer
类名称:Buffer
方法名:hasRemaining

Buffer.hasRemaining介绍

[英]Tells whether there are any elements between the current position and the limit.
[中]说明当前位置和限制之间是否存在任何元素。

代码示例

代码示例来源:origin: com.ning/async-http-client

if (buffer.hasRemaining()) {
  throw new IOException("Last chunk was alredy written");

代码示例来源:origin: com.ning/async-http-client

if (buffer.hasRemaining()) {
  final HttpContent content = requestPacket.httpContentBuilder()
      .content(buffer)

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
  public boolean hasInputRemaining(AttributeStorage storage, Buffer input) {
    return input != null && input.hasRemaining();
  }
}

代码示例来源:origin: javaee/grizzly

@Override
  public boolean hasInputRemaining(AttributeStorage storage, Buffer input) {
    return input != null && input.hasRemaining();
  }
}

代码示例来源:origin: javaee/grizzly

public OutputQueueRecord(final int streamId,
             final Buffer buffer,
             final CompletionHandler<WriteResult> completionHandler,
             final boolean isLast) {
  super(null, null, null);
  this.streamId = streamId;
  this.buffer = buffer;
  this.isZeroSizeData = !buffer.hasRemaining();
  this.originalCompletionHandler = completionHandler;
  this.isLast = isLast;
}

代码示例来源:origin: javaee/grizzly

@Override
  public boolean hasInputRemaining(AttributeStorage storage, Buffer input) {
    return input != null && input.hasRemaining();
  }
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean hasInputRemaining(final AttributeStorage storage,
                 final Buffer input) {
  return input != null && input.hasRemaining();
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean hasInputRemaining(final AttributeStorage storage,
                 final Buffer input) {
  return input != null && input.hasRemaining();
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public boolean hasInputRemaining(AttributeStorage storage, Buffer input) {
  return input.hasRemaining();
}

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework

/**
 * {@inheritDoc}
 */
@Override
public boolean hasInputRemaining(AttributeStorage storage, Buffer input) {
  return input.hasRemaining();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http2

public OutputQueueRecord(final int streamId,
             final Buffer buffer,
             final CompletionHandler<WriteResult> completionHandler,
             final boolean isLast) {
  super(null, null, null);
  this.streamId = streamId;
  this.buffer = buffer;
  this.isZeroSizeData = !buffer.hasRemaining();
  this.originalCompletionHandler = completionHandler;
  this.isLast = isLast;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
public boolean hasInputRemaining(final AttributeStorage storage,
                 final Buffer input) {
  return input != null && input.hasRemaining();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@Override
public boolean hasInputRemaining(AttributeStorage storage, Buffer input) {
  return input.hasRemaining();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

public static Buffer put(final MemoryManager memoryManager,
             Buffer dstBuffer, final byte value) {
  if (!dstBuffer.hasRemaining()) {
    dstBuffer = resizeBuffer(memoryManager, dstBuffer, 1);
  }
  dstBuffer.put(value);
  return dstBuffer;
}

代码示例来源:origin: javaee/grizzly

@Override
protected boolean onHttpHeaderParsed(final HttpHeader httpHeader,
                   final Buffer buffer,
                   final FilterChainContext ctx) {
  final ServerHttpRequestImpl request = (ServerHttpRequestImpl) httpHeader;
  prepareRequest(request, buffer.hasRemaining());
  return request.getProcessingState().error;
}

代码示例来源:origin: javaee/grizzly

@Override
protected boolean onHttpHeaderParsed(final HttpHeader httpHeader,
                   final Buffer buffer,
                   final FilterChainContext ctx) {
  final ServerHttpRequestImpl request = (ServerHttpRequestImpl) httpHeader;
  prepareRequest(request, buffer.hasRemaining());
  return request.getProcessingState().error;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http

public static Buffer put(final MemoryManager memoryManager,
             Buffer dstBuffer, final byte value) {
  if (!dstBuffer.hasRemaining()) {
    dstBuffer = resizeBuffer(memoryManager, dstBuffer, 1);
  }
  dstBuffer.put(value);
  return dstBuffer;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http2

public static Http2Frame fromBuffer(final int streamId, final Buffer frameBuffer) {
  GoAwayFrame frame = create();
  frame.setStreamId(streamId);
  frame.lastStreamId = frameBuffer.getInt() & 0x7fffffff;
  frame.errorCode = ErrorCode.lookup(frameBuffer.getInt());
  frame.additionalDebugData = frameBuffer.hasRemaining()
      ? frameBuffer
      : null;
  frame.setFrameBuffer(frameBuffer);
  
  return frame;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

public static Http2Frame fromBuffer(final int streamId, final Buffer frameBuffer) {
  GoAwayFrame frame = create();
  frame.setStreamId(streamId);
  frame.lastStreamId = frameBuffer.getInt() & 0x7fffffff;
  frame.errorCode = ErrorCode.lookup(frameBuffer.getInt());
  frame.additionalDebugData = frameBuffer.hasRemaining()
      ? frameBuffer
      : null;
  frame.setFrameBuffer(frameBuffer);
  
  return frame;
}

代码示例来源:origin: javaee/grizzly

private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) {
    final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection());
    holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader());
    holder.webSocket.onConnect();
    
    if (content.getContent().hasRemaining()) {
      return ctx.getRerunFilterAction();
    } else {
      content.recycle();
      return ctx.getStopAction();
    }
  }
}

相关文章