Skip to content

Commit 714b2db

Browse files
committed
Rename to FSTDataOutputWriter
1 parent ccf1036 commit 714b2db

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

lucene/core/src/java/org/apache/lucene/util/fst/BytesStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ public void close() {
381381
}
382382
}
383383

384-
/** Writes all of our bytes to the target {@link FSTWriter}. */
385-
public void writeTo(FSTWriter out) throws IOException {
384+
/** Writes all of our bytes to the target {@link FSTDataOutputWriter}. */
385+
public void writeTo(FSTDataOutputWriter out) throws IOException {
386386
reverse(0, getPosition() - 1);
387387
for (byte[] block : blocks) {
388388
if (block == current) { // last block

lucene/core/src/java/org/apache/lucene/util/fst/FSTCompiler.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public class FSTCompiler<T> {
121121
long directAddressingExpansionCredit;
122122

123123
// writer for frozen nodes
124-
final FSTWriter fstWriter;
124+
final FSTDataOutputWriter fstWriter;
125125
// reader for the frozen nodes
126126
final FSTReader fstReader;
127127

@@ -135,7 +135,12 @@ public class FSTCompiler<T> {
135135
// TODO: remove this? Builder API should be the only entry point?
136136
public FSTCompiler(FST.INPUT_TYPE inputType, Outputs<T> outputs) {
137137
this(
138-
inputType, 32.0, outputs, true, new FSTWriter(getLegacyDataOutput(DEFAULT_BLOCK_BITS)), 1f);
138+
inputType,
139+
32.0,
140+
outputs,
141+
true,
142+
new FSTDataOutputWriter(getLegacyDataOutput(DEFAULT_BLOCK_BITS)),
143+
1f);
139144
}
140145

141146
static DataOutput getLegacyDataOutput(int blockBits) {
@@ -147,7 +152,7 @@ private FSTCompiler(
147152
double suffixRAMLimitMB,
148153
Outputs<T> outputs,
149154
boolean allowFixedLengthArcs,
150-
FSTWriter fstWriter,
155+
FSTDataOutputWriter fstWriter,
151156
float directAddressingMaxOversizingFactor) {
152157
this.allowFixedLengthArcs = allowFixedLengthArcs;
153158
this.directAddressingMaxOversizingFactor = directAddressingMaxOversizingFactor;
@@ -301,7 +306,7 @@ public FSTCompiler<T> build() {
301306
suffixRAMLimitMB,
302307
outputs,
303308
allowFixedLengthArcs,
304-
new FSTWriter(dataOutput),
309+
new FSTDataOutputWriter(dataOutput),
305310
directAddressingMaxOversizingFactor);
306311
return fstCompiler;
307312
}

lucene/core/src/java/org/apache/lucene/util/fst/FSTWriter.java renamed to lucene/core/src/java/org/apache/lucene/util/fst/FSTDataOutputWriter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
* corresponding {@link org.apache.lucene.store.DataInput} and use the {@link FSTStore} to read pr
2929
* 2. use a DataOutput which also implements {@link FSTReader}
3030
*/
31-
final class FSTWriter {
31+
final class FSTDataOutputWriter {
3232

3333
private static final long BASE_RAM_BYTES_USED =
34-
RamUsageEstimator.shallowSizeOfInstance(FSTWriter.class);
34+
RamUsageEstimator.shallowSizeOfInstance(FSTDataOutputWriter.class);
3535

3636
/** the main DataOutput to store the FST bytes */
3737
private final DataOutput dataOutput;
@@ -43,7 +43,7 @@ final class FSTWriter {
4343
*
4444
* @param dataOutput the data output to write to
4545
*/
46-
public FSTWriter(DataOutput dataOutput) {
46+
public FSTDataOutputWriter(DataOutput dataOutput) {
4747
this.dataOutput = dataOutput;
4848
}
4949

lucene/core/src/test/org/apache/lucene/util/fst/TestFSTWriter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public void testRandom() throws Exception {
6363
final int numBytes = TestUtil.nextInt(random(), 1, maxBytes);
6464
final byte[] expected = new byte[numBytes];
6565
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
66-
final FSTWriter fstWriter = new FSTWriter(new OutputStreamDataOutput(baos));
66+
final FSTDataOutputWriter fstWriter =
67+
new FSTDataOutputWriter(new OutputStreamDataOutput(baos));
6768
FSTReader reader = fstWriter.getReader();
6869
if (VERBOSE) {
6970
System.out.println("TEST: iter=" + iter + " numBytes=" + numBytes);

0 commit comments

Comments
 (0)