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

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

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

ByteBuffer.capacity介绍

暂无

代码示例

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

public int capacity() {
  return buf.capacity();
}

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

public ByteBuffer capacity(int newCapacity) {
  buf.capacity(newCapacity);
  return this;
}

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

@Override
public String toString() {
  StringBuffer buf = new StringBuffer();
  if (isDirect()) {
    buf.append("DirectBuffer");
  } else {
    buf.append("HeapBuffer");
  }
  buf.append("[pos=");
  buf.append(position());
  buf.append(" lim=");
  buf.append(limit());
  buf.append(" cap=");
  buf.append(capacity());
  buf.append(": ");
  buf.append(getHexDump());
  buf.append(']');
  return buf.toString();
}

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

public Invite createInviteRequest(final String displayName, 
  final URI toUri, final URI fromUri, final UUID instanceId, 
  final URI contactUri, final ByteBuffer body)
  {
  final Map<String, SipHeader> headers = 
    createHeaders("INVITE", displayName, toUri, fromUri,
    instanceId, contactUri, body.capacity());
  return new Invite(toUri, headers, body);
  }

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

private static ByteBuffer createBuffer(final ByteBuffer buffer)
  {
  final ByteBuffer data = ByteBuffer.allocate(
    buffer.limit() - buffer.position());
  
  LOG.trace("Created buffer with capacity: "+data.capacity());
  data.put(buffer);
  data.rewind();
  return data;
  }

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

public SipResponse createInviteOk(final Invite request, 
  final UUID instanceId, final URI contactUri, final ByteBuffer body)
  {
  final Map<String, SipHeader> headers = createResponseHeaders(request);
  addRecordRoute(request, headers);
  addContact(headers, instanceId, contactUri);
  addContentLength(headers, body.capacity());
  
  final SipResponse response = new SipResponse(200, "OK", headers, body);
  return response;
  }

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

private void storeRemainingInSession(ByteBuffer buf, IoSession session) {
    ByteBuffer remainingBuf = ByteBuffer.allocate(buf.capacity());
    remainingBuf.setAutoExpand(true);
    remainingBuf.order(buf.order());
    remainingBuf.put(buf);
    session.setAttribute(BUFFER, remainingBuf);
  }
}

相关文章