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

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

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

ByteBuffer.clear介绍

暂无

代码示例

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

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

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

/**
 * Clears this buffer and fills its content with <tt>value</tt>.
 * The position is set to zero, the limit is set to the capacity,
 * and the mark is discarded.
 */
public ByteBuffer sweep(byte value) {
  clear();
  return fillAndReset(value, remaining());
}

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

/**
 * Clears this buffer and fills its content with <tt>NUL</tt>.
 * The position is set to zero, the limit is set to the capacity,
 * and the mark is discarded.
 */
public ByteBuffer sweep() {
  clear();
  return fillAndReset(remaining());
}

代码示例来源: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

public void append(ByteBuffer in) {
  if (overflowPosition != 0) {
    discard(in);
  } else if (buf.position() > maxLineLength - in.remaining()) {
      overflowPosition = buf.position();
      buf.clear();
      discard(in);
  } else {
    getBuffer().put(in);
  }
}

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

out.write(buf.getString(ctx.getDecoder()));
} finally {
  buf.clear();

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

out.write(buf.getString(ctx.getDecoder()));
} finally {
  buf.clear();

代码示例来源:origin: org.littleshoot/sip-stack

buf.clear();

相关文章