public final class PagedBytes extends java.lang.Object implements Accountable
Modifier and Type | Class and Description |
---|---|
class |
PagedBytes.PagedBytesDataInput |
class |
PagedBytes.PagedBytesDataOutput |
static class |
PagedBytes.Reader
Provides methods to read BytesRefs from a frozen
PagedBytes.
|
Modifier and Type | Field and Description |
---|---|
private static long |
BASE_RAM_BYTES_USED |
private int |
blockBits |
private int |
blockMask |
private byte[][] |
blocks |
private int |
blockSize |
private long |
bytesUsedPerBlock |
private byte[] |
currentBlock |
private boolean |
didSkipBytes |
private static byte[] |
EMPTY_BYTES |
private boolean |
frozen |
private int |
numBlocks |
private int |
upto |
Constructor and Description |
---|
PagedBytes(int blockBits)
1<<blockBits must be bigger than biggest single
BytesRef slice that will be pulled
|
Modifier and Type | Method and Description |
---|---|
private void |
addBlock(byte[] block) |
void |
copy(BytesRef bytes,
BytesRef out)
Copy BytesRef in, setting BytesRef out to the result.
|
void |
copy(IndexInput in,
long byteCount)
Read this many bytes from in
|
long |
copyUsingLengthPrefix(BytesRef bytes)
Copy bytes in, writing the length as a 1 or 2 byte
vInt prefix.
|
PagedBytes.Reader |
freeze(boolean trim)
Commits final byte[], trimming it if necessary and if trim=true
|
PagedBytes.PagedBytesDataInput |
getDataInput()
Returns a DataInput to read values from this
PagedBytes instance.
|
PagedBytes.PagedBytesDataOutput |
getDataOutput()
Returns a DataOutput that you may use to write into
this PagedBytes instance.
|
long |
getPointer() |
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildResources
private static final long BASE_RAM_BYTES_USED
private byte[][] blocks
private int numBlocks
private final int blockSize
private final int blockBits
private final int blockMask
private boolean didSkipBytes
private boolean frozen
private int upto
private byte[] currentBlock
private final long bytesUsedPerBlock
private static final byte[] EMPTY_BYTES
public PagedBytes(int blockBits)
private void addBlock(byte[] block)
public void copy(IndexInput in, long byteCount) throws java.io.IOException
java.io.IOException
public void copy(BytesRef bytes, BytesRef out)
public PagedBytes.Reader freeze(boolean trim)
public long getPointer()
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
public long copyUsingLengthPrefix(BytesRef bytes)
public PagedBytes.PagedBytesDataInput getDataInput()
public PagedBytes.PagedBytesDataOutput getDataOutput()