本文整理了Java中io.netty.buffer.ByteBuf.isWritable()
方法的一些代码示例,展示了ByteBuf.isWritable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.isWritable()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:isWritable
[英]Returns trueif and only if (this.capacity - this.writerIndex) is greater than 0.
[中]仅当(this.capacity-this.writerIndex)大于0时返回trueif。
代码示例来源:origin: apache/incubator-dubbo
@Override
public boolean writable() {
return buffer.isWritable();
}
代码示例来源:origin: netty/netty
@Override
public final boolean isWritable(int size) {
return buf.isWritable(size);
}
代码示例来源:origin: netty/netty
@Override
public final boolean isWritable() {
return buf.isWritable();
}
代码示例来源:origin: netty/netty
@Override
public boolean isWritable(int size) {
return buf.isWritable(size);
}
代码示例来源:origin: netty/netty
@Override
public boolean isWritable() {
return buf.isWritable();
}
代码示例来源:origin: redisson/redisson
@Override
public boolean isWritable(int size) {
return buf.isWritable(size);
}
代码示例来源:origin: redisson/redisson
@Override
public final boolean isWritable() {
return buf.isWritable();
}
代码示例来源:origin: redisson/redisson
@Override
public final boolean isWritable(int size) {
return buf.isWritable(size);
}
代码示例来源:origin: redisson/redisson
@Override
public boolean isWritable() {
return buf.isWritable();
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean isWritable() {
return buf.isWritable();
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean writable() {
return buffer.isWritable();
}
代码示例来源:origin: wildfly/wildfly
@Override
public final boolean isWritable(int size) {
return buf.isWritable(size);
}
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
public final boolean isWritable() {
return byteBuf.isWritable();
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean isWritable(int size) {
return buf.isWritable(size);
}
代码示例来源:origin: wildfly/wildfly
@Override
public final boolean isWritable() {
return buf.isWritable();
}
代码示例来源:origin: netty/netty
/**
* {@inheritDoc}
*
* Encodes the input buffer into {@link #blockSize} chunks in the output buffer. Data is only compressed and
* written once we hit the {@link #blockSize}; else, it is copied into the backing {@link #buffer} to await
* more data.
*/
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
if (finished) {
if (!out.isWritable(in.readableBytes())) {
// out should be EMPTY_BUFFER because we should have allocated enough space above in allocateBuffer.
throw ENCODE_FINSHED_EXCEPTION;
}
out.writeBytes(in);
return;
}
final ByteBuf buffer = this.buffer;
int length;
while ((length = in.readableBytes()) > 0) {
final int nextChunkSize = Math.min(length, buffer.writableBytes());
in.readBytes(buffer, nextChunkSize);
if (!buffer.isWritable()) {
flushBufferedData(out);
}
}
}
代码示例来源:origin: AsyncHttpClient/async-http-client
private BodyState readNextChunk(ByteBuf target) {
BodyState res = BodyState.SUSPEND;
while (target.isWritable() && state != BodyState.STOP) {
BodyChunk nextChunk = queue.peek();
if (nextChunk == null) {
// Nothing in the queue. suspend stream if nothing was read. (reads == 0)
return res;
} else if (!nextChunk.buffer.isReadable() && !nextChunk.last) {
// skip empty buffers
queue.remove();
} else {
res = BodyState.CONTINUE;
readChunk(target, nextChunk);
}
}
return res;
}
代码示例来源:origin: redisson/redisson
private static boolean attemptCopyToCumulation(ByteBuf cumulation, ByteBuf next, int wrapDataSize) {
final int inReadableBytes = next.readableBytes();
final int cumulationCapacity = cumulation.capacity();
if (wrapDataSize - cumulation.readableBytes() >= inReadableBytes &&
// Avoid using the same buffer if next's data would make cumulation exceed the wrapDataSize.
// Only copy if there is enough space available and the capacity is large enough, and attempt to
// resize if the capacity is small.
(cumulation.isWritable(inReadableBytes) && cumulationCapacity >= wrapDataSize ||
cumulationCapacity < wrapDataSize &&
ensureWritableSuccess(cumulation.ensureWritable(inReadableBytes, false)))) {
cumulation.writeBytes(next);
next.release();
return true;
}
return false;
}
代码示例来源:origin: AsyncHttpClient/async-http-client
public BodyState transferTo(ByteBuf target) throws IOException {
if (done)
return BodyState.STOP;
while (target.isWritable() && !done) {
MultipartPart<? extends Part> currentPart = parts.get(currentPartIndex);
currentPart.transferTo(target);
if (currentPart.getState() == MultipartState.DONE) {
currentPartIndex++;
if (currentPartIndex == parts.size()) {
done = true;
}
}
}
return BodyState.CONTINUE;
}
代码示例来源:origin: netty/netty
if (!footer.isWritable()) {
内容来源于网络,如有侵权,请联系作者删除!