io.netty.buffer.ByteBuf.maxWritableBytes()方法的使用及代码示例

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

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

ByteBuf.maxWritableBytes介绍

[英]Returns the maximum possible number of writable bytes, which is equal to (this.maxCapacity - this.writerIndex).
[中]返回可能的最大可写字节数,该字节数等于(this.maxCapacity-this.writeridex)。

代码示例

代码示例来源:origin: netty/netty

@Override
public final int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: netty/netty

@Override
public int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: redisson/redisson

@Override
public final int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: redisson/redisson

@Override
public int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: wildfly/wildfly

@Override
public final int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: wildfly/wildfly

@Override
public int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Override
public final int maxWritableBytes() {
  return byteBuf.maxWritableBytes();
}

代码示例来源:origin: netty/netty

@Override
protected int doReadBytes(ByteBuf buf) throws Exception {
  final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
  allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes())));
  return buf.writeBytes(is, allocHandle.attemptedBytesRead());
}

代码示例来源:origin: redisson/redisson

@Override
protected int doReadBytes(ByteBuf buf) throws Exception {
  final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
  allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes())));
  return buf.writeBytes(is, allocHandle.attemptedBytesRead());
}

代码示例来源:origin: wildfly/wildfly

@Override
protected int doReadBytes(ByteBuf buf) throws Exception {
  final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
  allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes())));
  return buf.writeBytes(is, allocHandle.attemptedBytesRead());
}

代码示例来源:origin: io.netty/netty-buffer

@Override
public int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: io.netty/netty-buffer

@Override
public final int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: resteasy/Resteasy

@Override
public void write(int b) throws IOException {
 if (buffer.maxWritableBytes() < 1) {
   flush();
 }
 buffer.writeByte(b);
}

代码示例来源:origin: resteasy/Resteasy

@Override
public void write(byte[] b, int off, int len) throws IOException {
 int dataLengthLeftToWrite = len;
 int dataToWriteOffset = off;
 int spaceLeftInCurrentChunk;
 while ((spaceLeftInCurrentChunk = buffer.maxWritableBytes()) < dataLengthLeftToWrite) {
   buffer.writeBytes(b, dataToWriteOffset, spaceLeftInCurrentChunk);
   dataToWriteOffset = dataToWriteOffset + spaceLeftInCurrentChunk;
   dataLengthLeftToWrite = dataLengthLeftToWrite - spaceLeftInCurrentChunk;
   flush();
 }
 if (dataLengthLeftToWrite > 0) {
   buffer.writeBytes(b, dataToWriteOffset, dataLengthLeftToWrite);
 }
}

代码示例来源:origin: apache/activemq-artemis

@Override
public final int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public final int maxWritableBytes() {
  return buf.maxWritableBytes();
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
protected int doReadBytes(ByteBuf buf) throws Exception {
  final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
  allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes())));
  return buf.writeBytes(is, allocHandle.attemptedBytesRead());
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
protected int doReadBytes(ByteBuf buf) throws Exception {
  final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
  allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes())));
  return buf.writeBytes(is, allocHandle.attemptedBytesRead());
}

代码示例来源:origin: apache/activemq-artemis

@Override
protected int doReadBytes(ByteBuf buf) throws Exception {
  final RecvByteBufAllocator.Handle allocHandle = unsafe().recvBufAllocHandle();
  allocHandle.attemptedBytesRead(Math.max(1, Math.min(available(), buf.maxWritableBytes())));
  return buf.writeBytes(is, allocHandle.attemptedBytesRead());
}

相关文章

ByteBuf类方法