File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
fastfilter/src/main/java/org/fastfilter/xor Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 11package org .fastfilter .xor ;
22
3+ import java .io .*;
34import java .nio .ByteBuffer ;
45
56import 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 );
You can’t perform that action at this time.
0 commit comments