Package org.apache.lucene.util
Class PagedBytes
- java.lang.Object
-
- org.apache.lucene.util.PagedBytes
-
public final class PagedBytes extends Object
Represents a logical byte[] as a series of pages. You can write-once into the logical byte[] (append only), using copy, and then retrieve slices (BytesRef) into it using fill.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PagedBytes.PagedBytesDataInput
class
PagedBytes.PagedBytesDataOutput
static class
PagedBytes.Reader
Provides methods to read BytesRefs from a frozen PagedBytes.
-
Constructor Summary
Constructors Constructor Description PagedBytes(int blockBits)
1<
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copy(IndexInput in, long byteCount)
Read this many bytes from invoid
copy(BytesRef bytes)
Copy BytesRef invoid
copy(BytesRef bytes, BytesRef out)
Copy BytesRef in, setting BytesRef out to the result.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=truePagedBytes.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()
-
-
-
Constructor Detail
-
PagedBytes
public PagedBytes(int blockBits)
1<-
Method Detail
-
copy
public void copy(IndexInput in, long byteCount) throws IOException
Read this many bytes from in- Throws:
IOException
-
copy
public void copy(BytesRef bytes) throws IOException
Copy BytesRef in- Throws:
IOException
-
copy
public void copy(BytesRef bytes, BytesRef out) throws IOException
Copy BytesRef in, setting BytesRef out to the result. Do not use this if you will use freeze(true). This only supports bytes.length <= blockSize- Throws:
IOException
-
freeze
public PagedBytes.Reader freeze(boolean trim)
Commits final byte[], trimming it if necessary and if trim=true
-
getPointer
public long getPointer()
-
copyUsingLengthPrefix
public long copyUsingLengthPrefix(BytesRef bytes) throws IOException
Copy bytes in, writing the length as a 1 or 2 byte vInt prefix.- Throws:
IOException
-
getDataInput
public PagedBytes.PagedBytesDataInput getDataInput()
Returns a DataInput to read values from this PagedBytes instance.
-
getDataOutput
public PagedBytes.PagedBytesDataOutput getDataOutput()
Returns a DataOutput that you may use to write into this PagedBytes instance. If you do this, you should not call the other writing methods (eg, copy); results are undefined.
-
-
-
-