net.openhft.chronicle.bytes.Bytes.readPositionRemaining()方法的使用及代码示例

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

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

Bytes.readPositionRemaining介绍

暂无

代码示例

代码示例来源:origin: OpenHFT/Chronicle-Queue

@NotNull
private LongArrayValues arrayForAddress(@NotNull Wire wire, long secondaryAddress) {
  LongArrayValuesHolder holder = getIndexArray();
  if (holder.address == secondaryAddress)
    return holder.values;
  holder.address = secondaryAddress;
  wire.bytes().readPositionRemaining(secondaryAddress, 4); // to read the header.
  wire.readMetaDataHeader();
  return array(wire, holder.values, false);
}

代码示例来源:origin: net.openhft/chronicle-bytes

@ForceInline
public static void setLength(@NotNull Appendable sb, int newLength)
    throws BufferUnderflowException, IllegalArgumentException {
  if (sb instanceof StringBuilder)
    ((StringBuilder) sb).setLength(newLength);
  else if (sb instanceof Bytes)
    ((Bytes) sb).readPositionRemaining(0, newLength);
  else
    throw new IllegalArgumentException("" + sb.getClass());
}

代码示例来源:origin: net.openhft/chronicle-engine

private Bytes getFileContentsFromDisk0(@NotNull Path path, Bytes using) throws IOException {
  if (!Files.exists(path)) return null;
  File file = path.toFile();
  Buffers b = Buffers.BUFFERS.get();
  Bytes<ByteBuffer> readingBytes = b.valueBuffer;
  try (FileChannel fc = new FileInputStream(file).getChannel()) {
    readingBytes.ensureCapacity(fc.size());
    @Nullable ByteBuffer dst = readingBytes.underlyingObject();
    dst.clear();
    fc.read(dst);
    readingBytes.readPositionRemaining(0, dst.position());
    dst.flip();
  }
  readingBytes.reserve();
  return readingBytes;
}

代码示例来源:origin: net.openhft/chronicle-queue

@NotNull
private LongArrayValues arrayForAddress(@NotNull Wire wire, long secondaryAddress) {
  LongArrayValuesHolder holder = getIndexArray();
  if (holder.address == secondaryAddress)
    return holder.values;
  holder.address = secondaryAddress;
  wire.bytes().readPositionRemaining(secondaryAddress, 4); // to read the header.
  wire.readMetaDataHeader();
  return array(wire, holder.values, false);
}

代码示例来源:origin: net.openhft/chronicle-bytes

/**
 * The buffer is not modified by this call
 *
 * @param buffer   the buffer to use
 * @param position the position to create the string from
 * @param len      the number of characters to show in the string
 * @return a string contain the text from offset {@code position}
 */
static String toString(@NotNull final Bytes buffer, long position, long len)
    throws BufferUnderflowException {
  final long pos = buffer.readPosition();
  final long limit = buffer.readLimit();
  buffer.readPositionRemaining(position, len);
  try {
    @NotNull final StringBuilder builder = new StringBuilder();
    while (buffer.readRemaining() > 0) {
      builder.append((char) buffer.readByte());
    }
    // remove the last comma
    return builder.toString();
  } finally {
    buffer.readLimit(limit);
    buffer.readPosition(pos);
  }
}

代码示例来源:origin: net.openhft/chronicle-bytes

bytes.readPositionRemaining(offset, len);

代码示例来源:origin: net.openhft/chronicle-bytes

int outputSize = cipher.getOutputSize(Math.toIntExact(size));
outBytes.ensureCapacity(writePos + outputSize);
outBytes.readPositionRemaining(writePos, outputSize);
BytesInternal.assignBytesStoreToByteBuffer(outBytes, using2);
int len = cipher.update(using1, using2);

相关文章

微信公众号

最新文章

更多