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

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

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

ByteBuffer.compact介绍

暂无

代码示例

代码示例来源:origin: org.littleshoot/mina-port

public ByteBuffer compact() {
  buf.compact();
  return this;
}

代码示例来源:origin: org.littleshoot/mina-util

public void write(final ByteBuffer src)
  {
  m_log.debug("Writing data to input stream...");
  m_rawBytesReceived += src.remaining();
  m_log.debug("Received raw bytes: {}", m_rawBytesReceived);
  synchronized (m_mutex)
    {
    if (m_closed)
      {
      m_log.debug("InputStream closed...");
      return;
      }
    if (m_buf.hasRemaining())
      {
      m_log.debug("Copying buffer data...");
      this.m_buf.compact();
      this.m_buf.put(src);
      this.m_buf.flip();
      m_mutex.notifyAll();
      }
    else
      {
      m_log.debug("Nothing remaining in buffer...");
      this.m_buf.clear();
      this.m_buf.put(src);
      this.m_buf.flip();
      m_mutex.notifyAll();
      }
    }
  }

代码示例来源:origin: org.littleshoot/mina-port

public void write(ByteBuffer src) {
  synchronized (mutex) {
    if (closed) {
      return;
    }
    if (buf.hasRemaining()) {
      this.buf.compact();
      this.buf.put(src);
      this.buf.flip();
    } else {
      this.buf.clear();
      this.buf.put(src);
      this.buf.flip();
      mutex.notifyAll();
    }
  }
}

代码示例来源:origin: org.littleshoot/mina-port

buf.compact();
else
  storeRemainingInSession(buf, session);

相关文章