com.couchbase.client.deps.io.netty.buffer.ByteBuf.getBytes()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(242)

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

ByteBuf.getBytes介绍

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

代码示例

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

void verify(Bucket bucket)
   throws UnsupportedEncodingException {
  // verify
  System.out.println("Starting verification procedure");
  for (Map.Entry<String, byte[]> cacheEntry : verificationCache.entrySet()) {
   Object doc = bucket.get(cacheEntry.getKey(), recordClass);
   if (doc instanceof TupleDocument) {
    ByteBuf returnedBuf = (((TupleDocument) doc).content()).value1();
    byte[] returnedBytes = new byte[returnedBuf.readableBytes()];
    returnedBuf.getBytes(0, returnedBytes);
    Assert.assertEquals(returnedBytes, cacheEntry.getValue(), "Returned content for TupleDoc should be equal");
   } else if (doc instanceof RawJsonDocument) {
    byte[] returnedBytes = ((RawJsonDocument) doc).content().getBytes("UTF-8");
    Assert.assertEquals(returnedBytes, cacheEntry.getValue(), "Returned content for JsonDoc should be equal");
   } else {
    Assert.fail("Returned type was neither TupleDocument nor RawJsonDocument");
   }
  }
  System.out.println("Verification success!");
 }
}

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

void onWrite(AbstractDocument doc)
  throws UnsupportedEncodingException {
 recordClass = doc.getClass();
 if (doc instanceof TupleDocument) {
  ByteBuf outgoingBuf = (((TupleDocument) doc).content()).value1();
  byte[] outgoingBytes = new byte[outgoingBuf.readableBytes()];
  outgoingBuf.getBytes(0, outgoingBytes);
  verificationCache.put(doc.id(), outgoingBytes);
 } else if (doc instanceof RawJsonDocument) {
  verificationCache.put(doc.id(), ((RawJsonDocument) doc).content().getBytes("UTF-8"));
 } else {
  throw new UnsupportedOperationException("Can only support TupleDocument or RawJsonDocument at this time");
 }
}

代码示例来源:origin: apache/nifi

byteBuf.getBytes(byteBuf.readerIndex(), out, byteBuf.readableBytes());
  byteBuf.release();
};

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, byte[] dst) {
  buf.getBytes(index, dst);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, ByteBuffer dst) {
  buf.getBytes(index, dst);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  buf.getBytes(index, dst, dstIndex, length);
  return this;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

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

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public ByteBuf getBytes(int index, byte[] dst) {
  buf.getBytes(index, dst);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  unwrap().getBytes(index, dst, dstIndex, length);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length) {
  unwrap().getBytes(index, dst, dstIndex, length);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, OutputStream out, int length)
    throws IOException {
  unwrap().getBytes(index, out, length);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public int getBytes(int index, GatheringByteChannel out, int length)
    throws IOException {
  return unwrap().getBytes(index, out, length);
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, OutputStream out, int length)
    throws IOException {
  unwrap().getBytes(index, out, length);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length) {
  checkIndex(index, length);
  buffer.getBytes(index, dst, dstIndex, length);
  return this;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public ByteBuf getBytes(int index, OutputStream out, int length)
    throws IOException {
  unwrap().getBytes(index, out, length);
  return this;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  unwrap().getBytes(index, dst, dstIndex, length);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  checkIndex0(index, length);
  unwrap().getBytes(idx(index), dst, dstIndex, length);
  return this;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
  checkIndex0(index, length);
  unwrap().getBytes(idx(index), dst, dstIndex, length);
  return this;
}

相关文章