Method GetWriter
GetWriter(DataOutput, Int32, Int32, Single)
Create a packed integer array writer for the given output, format, value count, and number of bits per value.
The resulting stream will be long-aligned. this means that depending on
the format which is used under the hoods, up to 63 bits will be wasted.
An easy way to make sure that no space is lost is to always use a
valueCount
that is a multiple of 64.
This method writes metadata to the stream, so that the resulting stream is
sufficient to restore a PackedInt32s.Reader from it. You don't need to track
valueCount
or bitsPerValue
by yourself. In case
this is a problem, you should probably look at
GetWriterNoHeader(DataOutput, PackedInt32s.Format, Int32, Int32, Int32).
The acceptableOverheadRatio
parameter controls how
readers that will be restored from this stream trade space
for speed by selecting a faster but potentially less memory-efficient
implementation. An acceptableOverheadRatio
of
COMPACT will make sure that the most memory-efficient
implementation is selected whereas FASTEST will make sure
that the fastest implementation is selected. In case you are only interested
in reading this stream sequentially later on, you should probably use
COMPACT.
@lucene.internal
Declaration
public static PackedInt32s.Writer GetWriter(DataOutput out, int valueCount, int bitsPerValue, float acceptableOverheadRatio)
Parameters
Type | Name | Description |
---|---|---|
DataOutput | out | The data output. |
System.Int32 | valueCount | The number of values. |
System.Int32 | bitsPerValue | The number of bits per value. |
System.Single | acceptableOverheadRatio | An acceptable overhead ratio per value. |
Returns
Type | Description |
---|---|
PackedInt32s.Writer |