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

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

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

ByteBuf.refCnt介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public boolean isAllocated() {
  return this.byteBuf.refCnt() > 0;
}

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

@Override
public int refCnt() {
  return data.refCnt();
}

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

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

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

@Override
public int refCnt() {
  return buffer.refCnt();
}

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

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

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public int refCnt() {
 return content.refCnt();
}

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

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

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

@Override
public int refCnt() {
  return data.refCnt();
}

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

@Override
public int refCnt() {
  return buffer.refCnt();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public int refCnt() {
 return binaryData.refCnt();
}

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

@Override
public int refCnt() {
  return content.refCnt();
}

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

@Override
public ByteBuf content() {
  if (data.refCnt() <= 0) {
    throw new IllegalReferenceCountException(data.refCnt());
  }
  return data;
}

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

@Override
public ByteBuf content() {
  if (data.refCnt() <= 0) {
    throw new IllegalReferenceCountException(data.refCnt());
  }
  return data;
}

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

protected final void discardSomeReadBytes() {
  if (cumulation != null && !first && cumulation.refCnt() == 1) {
    // discard some bytes if possible to make more room in the
    // buffer but only if the refCnt == 1  as otherwise the user may have
    // used slice().retain() or duplicate().retain().
    //
    // See:
    // - https://github.com/netty/netty/issues/2327
    // - https://github.com/netty/netty/issues/1764
    cumulation.discardSomeReadBytes();
  }
}

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

int refCnt0() {
  return unwrap().refCnt();
}

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

protected final void discardSomeReadBytes() {
  if (cumulation != null && !first && cumulation.refCnt() == 1) {
    // discard some bytes if possible to make more room in the
    // buffer but only if the refCnt == 1  as otherwise the user may have
    // used slice().retain() or duplicate().retain().
    //
    // See:
    // - https://github.com/netty/netty/issues/2327
    // - https://github.com/netty/netty/issues/1764
    cumulation.discardSomeReadBytes();
  }
}

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

@Override
public int refCnt() {
  return content().refCnt();
}

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

int refCnt0() {
  return unwrap().refCnt();
}

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

@SuppressWarnings("deprecation")
private Component newComponent(ByteBuf buf, int offset) {
  if (checkAccessible && buf.refCnt() == 0) {
    throw new IllegalReferenceCountException(0);
  }
  int srcIndex = buf.readerIndex(), len = buf.readableBytes();
  ByteBuf slice = null;
  if (buf instanceof AbstractUnpooledSlicedByteBuf) {
    srcIndex += ((AbstractUnpooledSlicedByteBuf) buf).idx(0);
    slice = buf;
    buf = buf.unwrap();
  } else if (buf instanceof PooledSlicedByteBuf) {
    srcIndex += ((PooledSlicedByteBuf) buf).adjustment;
    slice = buf;
    buf = buf.unwrap();
  }
  return new Component(buf.order(ByteOrder.BIG_ENDIAN), srcIndex, offset, len, slice);
}

代码示例来源:origin: spring-projects/spring-framework

private static void assertReleased(DataBuffer dataBuffer) {
  if (dataBuffer instanceof NettyDataBuffer) {
    ByteBuf byteBuf = ((NettyDataBuffer) dataBuffer).getNativeBuffer();
    assertEquals(0, byteBuf.refCnt());
  }
}

相关文章

ByteBuf类方法