- java.lang.Object
-
- org.apache.lucene.store.DataOutput
-
- org.apache.lucene.util.fst.GrowableByteArrayDataOutput
-
- All Implemented Interfaces:
Accountable
final class GrowableByteArrayDataOutput extends DataOutput implements Accountable
-
-
Field Summary
Fields Modifier and Type Field Description private static long
BASE_RAM_BYTES_USED
private byte[]
bytes
private static int
INITIAL_SIZE
private int
nextWrite
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description GrowableByteArrayDataOutput()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
ensureCapacity(int capacityToWrite)
Ensure we can write additional capacityToWrite bytes.byte[]
getBytes()
int
getPosition()
long
ramBytesUsed()
Return the memory usage of this object in bytes.void
setPosition(int newLen)
Set the position of the byte[], increasing the capacity if neededvoid
writeByte(byte b)
Writes a single byte.void
writeBytes(byte[] b, int offset, int len)
Writes an array of bytes.void
writeTo(int srcOffset, byte[] dest, int destOffset, int len)
Copies bytes from this store to a target byte array.void
writeTo(DataOutput out)
Writes all of our bytes to the targetDataOutput
.-
Methods inherited from class org.apache.lucene.store.DataOutput
copyBytes, writeBytes, writeGroupVInts, writeInt, writeLong, writeMapOfStrings, writeSetOfStrings, writeShort, writeString, writeVInt, writeVLong, writeZInt, writeZLong
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
-
INITIAL_SIZE
private static final int INITIAL_SIZE
- See Also:
- Constant Field Values
-
bytes
private byte[] bytes
-
nextWrite
private int nextWrite
-
-
Method Detail
-
writeByte
public void writeByte(byte b)
Description copied from class:DataOutput
Writes 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:
writeByte
in classDataOutput
- See Also:
DataInput.readByte()
-
writeBytes
public void writeBytes(byte[] b, int offset, int len)
Description copied from class:DataOutput
Writes an array of bytes.- Specified by:
writeBytes
in 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)
-
getPosition
public int getPosition()
-
getBytes
public byte[] getBytes()
-
setPosition
public void setPosition(int newLen)
Set the position of the byte[], increasing the capacity if needed
-
ensureCapacity
private void ensureCapacity(int capacityToWrite)
Ensure we can write additional capacityToWrite bytes.- Parameters:
capacityToWrite
- the additional bytes to write
-
writeTo
public void writeTo(DataOutput out) throws java.io.IOException
Writes all of our bytes to the targetDataOutput
.- Throws:
java.io.IOException
-
writeTo
public void writeTo(int srcOffset, byte[] dest, int destOffset, int len)
Copies bytes from this store to a target byte array.
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
-