Package org.apache.lucene.util.fst
Class BytesStore
- java.lang.Object
-
- org.apache.lucene.store.DataOutput
-
- org.apache.lucene.util.fst.BytesStore
-
- All Implemented Interfaces:
Accountable
class BytesStore extends DataOutput implements Accountable
-
-
Field Summary
Fields Modifier and Type Field Description private static longBASE_RAM_BYTES_USEDprivate intblockBitsprivate intblockMaskprivate java.util.List<byte[]>blocksprivate intblockSizeprivate byte[]currentprivate intnextWrite-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description BytesStore(int blockBits)BytesStore(DataInput in, long numBytes, int maxBlockSize)Pulls bytes from the provided IndexInput.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopyBytes(long src, byte[] dest, int offset, int len)Copies bytes from this store to a target byte array.voidcopyBytes(long src, long dest, int len)Absolute copy bytes self to self, without changing the position.voidfinish()(package private) intgetBlockBits()FST.BytesReadergetForwardReader()longgetPosition()FST.BytesReadergetReverseReader()(package private) FST.BytesReadergetReverseReader(boolean allowSingle)longramBytesUsed()Return the memory usage of this object in bytes.voidreverse(long srcPos, long destPos)Reverse from srcPos, inclusive, to destPos, inclusive.voidskipBytes(int len)java.lang.StringtoString()voidtruncate(long newLen)Pos must be less than the max position written so far! Ie, you cannot "grow" the file with this!voidwriteByte(byte b)Writes a single byte.voidwriteByte(long dest, byte b)Absolute write byte; you must ensure dest is < max position written so far.voidwriteBytes(byte[] b, int offset, int len)Writes an array of bytes.(package private) voidwriteBytes(long dest, byte[] b, int offset, int len)Absolute writeBytes without changing the current position.voidwriteInt(long pos, int value)Writes an int at the absolute position without changing the current pointer.voidwriteTo(DataOutput out)Writes all of our bytes to the targetDataOutput.-
Methods inherited from class org.apache.lucene.store.DataOutput
copyBytes, writeBytes, writeInt, writeLong, writeMapOfStrings, writeSetOfStrings, writeShort, writeString, writeVInt, writeVLong, writeZInt, writeZLong
-
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
-
-
-
-
Field Detail
-
BASE_RAM_BYTES_USED
private static final long BASE_RAM_BYTES_USED
-
blocks
private final java.util.List<byte[]> blocks
-
blockSize
private final int blockSize
-
blockBits
private final int blockBits
-
blockMask
private final int blockMask
-
current
private byte[] current
-
nextWrite
private int nextWrite
-
-
Constructor Detail
-
BytesStore
public BytesStore(int blockBits)
-
BytesStore
public BytesStore(DataInput in, long numBytes, int maxBlockSize) throws java.io.IOException
Pulls bytes from the provided IndexInput.- Throws:
java.io.IOException
-
-
Method Detail
-
writeByte
public void writeByte(long dest, byte b)Absolute write byte; you must ensure dest is < max position written so far.
-
writeByte
public void writeByte(byte b)
Description copied from class:DataOutputWrites a single byte.The most primitive data type is an eight-bit byte. Files are accessed as sequences of bytes. All other data types are defined as sequences of bytes, so file formats are byte-order independent.
- Specified by:
writeBytein classDataOutput- See Also:
DataInput.readByte()
-
writeBytes
public void writeBytes(byte[] b, int offset, int len)Description copied from class:DataOutputWrites an array of bytes.- Specified by:
writeBytesin classDataOutput- Parameters:
b- the bytes to writeoffset- the offset in the byte arraylen- the number of bytes to write- See Also:
DataInput.readBytes(byte[],int,int)
-
getBlockBits
int getBlockBits()
-
writeBytes
void writeBytes(long dest, byte[] b, int offset, int len)Absolute writeBytes without changing the current position. Note: this cannot "grow" the bytes, so you must only call it on already written parts.
-
copyBytes
public void copyBytes(long src, long dest, int len)Absolute copy bytes self to self, without changing the position. Note: this cannot "grow" the bytes, so must only call it on already written parts.
-
copyBytes
public void copyBytes(long src, byte[] dest, int offset, int len)Copies bytes from this store to a target byte array.
-
writeInt
public void writeInt(long pos, int value)Writes an int at the absolute position without changing the current pointer.
-
reverse
public void reverse(long srcPos, long destPos)Reverse from srcPos, inclusive, to destPos, inclusive.
-
skipBytes
public void skipBytes(int len)
-
getPosition
public long getPosition()
-
truncate
public void truncate(long newLen)
Pos must be less than the max position written so far! Ie, you cannot "grow" the file with this!
-
finish
public void finish()
-
writeTo
public void writeTo(DataOutput out) throws java.io.IOException
Writes all of our bytes to the targetDataOutput.- Throws:
java.io.IOException
-
getForwardReader
public FST.BytesReader getForwardReader()
-
getReverseReader
public FST.BytesReader getReverseReader()
-
getReverseReader
FST.BytesReader getReverseReader(boolean allowSingle)
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-