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

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

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

ByteBuf.duplicate介绍

[英]Returns a buffer which shares the whole region of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modify readerIndex or writerIndex of this buffer.

The reader and writer marks will not be duplicated. Also be aware that this method will NOT call #retain() and so the reference count will NOT be increased.
[中]返回共享此缓冲区整个区域的缓冲区。修改返回的缓冲区或此缓冲区的内容会影响彼此的内容,同时它们会维护单独的索引和标记。此方法不修改此缓冲区的readerIndex或writerIndex。
读写器标记将不会重复。还要注意,此方法不会调用#retain(),因此引用计数不会增加。

代码示例

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

@Override
public ByteBuf duplicate() {
  return buf.duplicate();
}

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

public ByteBuf getByteBuf() {
 // Return a duplicate so the Buffer can be written multiple times.
 // See #648
 return buffer.duplicate();
}

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

@Override
public ByteBuf duplicate() {
  return buf.duplicate();
}

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

/**
 * {@inheritDoc}
 * <p>
 * This method calls {@code replace(content().duplicate())} by default.
 */
@Override
public ByteBufHolder duplicate() {
  return replace(data.duplicate());
}

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

@Override
public ByteBuf duplicate() {
  return buf.duplicate().order(order);
}

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

@Override
public ByteBuf duplicate() {
  return new UnreleasableByteBuf(buf.duplicate());
}

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

/**
 * {@inheritDoc}
 * <p>
 * This method calls {@code replace(content().duplicate())} by default.
 */
@Override
public ByteBufHolder duplicate() {
  return replace(data.duplicate());
}

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

@Override
public ByteBuf duplicate() {
  return new UnreleasableByteBuf(buf.duplicate());
}

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

@Override
public PemPrivateKey duplicate() {
  return replace(content.duplicate());
}

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

@Override
public ByteBuf duplicate() {
  return buf.duplicate().order(order);
}

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

@Override
public PemX509Certificate duplicate() {
  return replace(content.duplicate());
}

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

@Override
public PemValue duplicate() {
  return replace(content.duplicate());
}

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

@Override
public DatagramPacket duplicate() {
  return replace(content().duplicate());
}

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

@Override
public DatagramPacket duplicate() {
  return replace(content().duplicate());
}

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

@Override
public DnsRawRecord duplicate() {
  return replace(content().duplicate());
}

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

ByteBuf duplicate() {
  return buf.duplicate().setIndex(idx(offset), idx(endOffset));
}

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

@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpRequest msg) throws Exception {
 writeResponse(ctx, msg, PLAINTEXT_CONTENT_BUFFER.duplicate(), TYPE_PLAIN, PLAINTEXT_CLHEADER_VALUE);
}

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

ByteBuf duplicate() {
  return buf.duplicate().setIndex(idx(offset), idx(endOffset));
}

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

@Override
public ByteBuf duplicate() {
  return unwrap().duplicate().setIndex(idx(readerIndex()), idx(writerIndex()));
}

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

@Override
public ByteBuf duplicate() {
  return unwrap().duplicate().setIndex(idx(readerIndex()), idx(writerIndex()));
}

相关文章

ByteBuf类方法