PagedBytes.Reader (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.util, class: PagedBytes, class: Reader

Package org.apache.lucene.util

# Class PagedBytes.Reader

java.lang.Object
org.apache.lucene.util.PagedBytes.Reader

All Implemented Interfaces:
  `Accountable`

Enclosing class:
  `PagedBytes`

public static final class PagedBytes.Reader extends Object implements Accountable
Provides methods to read BytesRefs from a frozen PagedBytes.

See Also:
  - `PagedBytes.freeze(boolean)`

- ## Field Summary

  ### Fields inherited from interface org.apache.lucene.util.Accountable

  `NULL_ACCOUNTABLE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `fill(BytesRef b, long start)`
  Reads length as 1 or 2 byte vInt prefix, starting at start.
  `void`
  `fillSlice(BytesRef b, long start, int length)`
  Gets a slice out of `PagedBytes` starting at start with a given length.
  `byte`
  `getByte(long o)`
  Get the byte at the given offset.
  `long`
  `ramBytesUsed()`
  Returns an estimate of the JVM heap memory used by this object in bytes.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.apache.lucene.util.Accountable

  `getChildResources`

- ## Method Details

  - ### fillSlice

    public void fillSlice(BytesRef b, long start, int length)
    Gets a slice out of `PagedBytes` starting at start with a given length. Iff the slice spans across a block border this method will allocate sufficient resources and copy the paged data.

    Slices spanning more than two blocks are not supported.

    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

  - ### getByte

    public byte getByte(long o)
    Get the byte at the given offset.
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

  - ### fill

    public void fill(BytesRef b, long start)
    Reads length as 1 or 2 byte vInt prefix, starting at start.

    Note: this method does not support slices spanning across block borders.

    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

  - ### ramBytesUsed

    public long ramBytesUsed()
    Description copied from interface: `Accountable`
    Returns an estimate of the JVM heap memory used by this object in bytes. The method name uses "ram" for historical reasons; only JVM heap memory should be reported. Off-heap resources such as memory-mapped files or native direct buffers should not be included. Negative values are illegal.
    Specified by:
      `ramBytesUsed` in interface `Accountable`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`