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

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

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

ByteBuf.setBytes介绍

[英]Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer becomes unreadable. This method is basically same with #setBytes(int,ByteBuf,int,int), except that this method increases the readerIndex of the source buffer by the number of the transferred bytes while #setBytes(int,ByteBuf,int,int) does not. This method does not modify readerIndex or writerIndex of the source buffer (i.e. this).
[中]从指定的绝对索引开始,将指定源缓冲区的数据传输到此缓冲区,直到源缓冲区变得不可读为止。此方法与#setBytes(int,ByteBuf,int,int)基本相同,只是此方法将源缓冲区的readerIndex增加传输的字节数,而#setBytes(int,ByteBuf,int,int)不增加。此方法不会修改源缓冲区的readerIndex或writerIndex(即此)。

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
public void setBytes(int index, byte[] src, int srcIndex, int length) {
  buffer.setBytes(index, src, srcIndex, length);
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public void setBytes(int index, byte[] src) {
  buffer.setBytes(index, src);
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public void setBytes(int index, ByteBuffer src) {
  buffer.setBytes(index, src);
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public int setBytes(int index, InputStream src, int length) throws IOException {
  return buffer.setBytes(index, src, length);
}

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

@Override
public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) {
  buf.setBytes(index, src, srcIndex, length);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, ByteBuf src, int length) {
  buf.setBytes(index, src, length);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
  buf.setBytes(index, src, srcIndex, length);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) {
  buf.setBytes(index, src, srcIndex, length);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
  buf.setBytes(index, src, srcIndex, length);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) {
  unwrap().setBytes(index, src, srcIndex, length);
  return this;
}

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

@Override
public int setBytes(int index, ScatteringByteChannel in, int length)
    throws IOException {
  return unwrap().setBytes(index, in, length);
}

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

@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
  unwrap().setBytes(index, src, srcIndex, length);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, ByteBuffer src) {
  unwrap().setBytes(index, src);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, ByteBuffer src) {
  checkIndex0(index, src.remaining());
  unwrap().setBytes(idx(index), src);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) {
  checkIndex0(index, length);
  unwrap().setBytes(idx(index), src, srcIndex, length);
  return this;
}

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

@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
  checkIndex0(index, length);
  unwrap().setBytes(idx(index), src, srcIndex, length);
  return this;
}

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

@Override
public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException {
  checkIndex0(index, length);
  return unwrap().setBytes(idx(index), in, length);
}

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

@Override
public int setBytes(int index, FileChannel in, long position, int length) throws IOException {
  checkIndex0(index, length);
  return unwrap().setBytes(idx(index), in, position, length);
}

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

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  checkDstIndex(index, length, dstIndex, dst.capacity());
  if (dst.hasMemoryAddress()) {
    PlatformDependent.copyMemory(array, index, dst.memoryAddress() + dstIndex, length);
  } else if (dst.hasArray()) {
    getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
  } else {
    dst.setBytes(dstIndex, array, index, length);
  }
  return this;
}

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

@Override
public final ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  checkDstIndex(index, length, dstIndex, dst.capacity());
  if (dst.hasMemoryAddress()) {
    PlatformDependent.copyMemory(memory, idx(index), dst.memoryAddress() + dstIndex, length);
  } else if (dst.hasArray()) {
    getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
  } else {
    dst.setBytes(dstIndex, memory, idx(index), length);
  }
  return this;
}

相关文章

ByteBuf类方法