Skip to content

Commit 9e19bc6

Browse files
committed
Xor8: make methods deprecated
1 parent d5e2f63 commit 9e19bc6

File tree

1 file changed

+31
-0
lines changed
  • fastfilter/src/main/java/org/fastfilter/xor

1 file changed

+31
-0
lines changed

fastfilter/src/main/java/org/fastfilter/xor/Xor8.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.fastfilter.xor;
22

3+
import java.io.*;
34
import java.nio.ByteBuffer;
45

56
import org.fastfilter.Filter;
@@ -163,6 +164,36 @@ private int fingerprint(long hash) {
163164
return (int) (hash & ((1 << BITS_PER_FINGERPRINT) - 1));
164165
}
165166

167+
@Deprecated
168+
public byte[] getData() {
169+
try {
170+
ByteArrayOutputStream out = new ByteArrayOutputStream();
171+
DataOutputStream d = new DataOutputStream(out);
172+
d.writeInt(size);
173+
d.writeLong(seed);
174+
d.write(fingerprints);
175+
return out.toByteArray();
176+
} catch (IOException e) {
177+
throw new RuntimeException(e);
178+
}
179+
}
180+
181+
@Deprecated
182+
public Xor8(InputStream in) {
183+
try {
184+
DataInputStream din = new DataInputStream(in);
185+
size = din.readInt();
186+
arrayLength = getArrayLength(size);
187+
bitCount = arrayLength * BITS_PER_FINGERPRINT;
188+
blockLength = arrayLength / HASHES;
189+
seed = din.readLong();
190+
fingerprints = new byte[arrayLength];
191+
din.readFully(fingerprints);
192+
} catch (IOException e) {
193+
throw new RuntimeException(e);
194+
}
195+
}
196+
166197
private Xor8(int size, long seed, byte[] fingerprints) {
167198
this.size = size;
168199
this.arrayLength = getArrayLength(size);

0 commit comments

Comments
 (0)