org.apache.mina.common.ByteBuffer.expand()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(129)

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

ByteBuffer.expand介绍

[英]Changes the capacity and limit of this buffer so this buffer get the specified expectedRemaining room from the current position. This method works even if you didn't set autoExpand to true.
[中]更改此缓冲区的容量和限制,以便此缓冲区从当前位置获取指定的ExpectedRemining room。即使未将“自动展开”设置为true,此方法也有效。

代码示例

代码示例来源:origin: org.apache.directory.mina/mina-core

public ByteBuffer expand( int pos, int expectedRemaining )
{
  buf.expand( pos, expectedRemaining );
  return this;
}

代码示例来源:origin: org.apache.directory.mina/mina-core

public ByteBuffer expand( int expectedRemaining )
{
  buf.expand( expectedRemaining );
  return this;
}

代码示例来源:origin: org.apache.directory.mina/mina-core

/**
 * Changes the capacity and limit of this buffer so this buffer get
 * the specified <tt>expectedRemaining</tt> room from the current position.
 * This method works even if you didn't set <tt>autoExpand</tt> to
 * <tt>true</tt>.
 */
public ByteBuffer expand( int expectedRemaining )
{
  return expand( position(), expectedRemaining );
}

代码示例来源:origin: org.apache.directory.mina/mina-core

/**
 * This method forwards the call to {@link #expand(int)} only when
 * <tt>autoExpand</tt> property is <tt>true</tt>.
 */
protected ByteBuffer autoExpand( int expectedRemaining )
{
  if( isAutoExpand() )
  {
    expand( expectedRemaining );
  }
  return this;
}

代码示例来源:origin: org.apache.directory.mina/mina-core

/**
 * This method forwards the call to {@link #expand(int)} only when
 * <tt>autoExpand</tt> property is <tt>true</tt>.
 */
protected ByteBuffer autoExpand( int pos, int expectedRemaining )
{
  if( isAutoExpand() )
  {
    expand( pos, expectedRemaining );
  }
  return this;
}

代码示例来源:origin: org.reddwarfserver.client/sgs-client

/**
 * Processes network data of arbitrary length and dispatches zero or
 * more complete messages to the given {@code listener}.  If a partial
 * message remains, it is buffered until more data is received.
 *
 * @param listener the {@code FilterListener} to receive complete messages
 * @param buf the data to filter and optionally deliver to the
 *        {@code FilterListener}
 */
void filterReceive(FilterListener listener, ByteBuffer buf) {
  logger.log(Level.FINEST,
    "processing {0,number,#} bytes",
    buf.remaining());
  // Append the new data to the buffer
  msgBuf.expand(buf.remaining());
  msgBuf.put(buf);
  msgBuf.flip();
  processReceiveBuffer(listener);
}

相关文章