private void readObject(ObjectInputStream in) throws IOException { short version = in.readShort(); switch (version) { case 0x0001: this.value = in.readFloat(); break; default: throw new UnsupportedVersionException(this, version); } }
/** * Reads a file from a given InputStream, where the hash bundles are specified. Make sure to * generate it first and make sure to re-use it for search. * * @param inputStream to access the data, most likely a File on a hard disk * @return * @throws IOException */ public static double[][][] readHashFunctions(InputStream inputStream) throws IOException { ObjectInputStream ois = new ObjectInputStream(new GZIPInputStream(inputStream)); int bits = ois.readInt(); int dimensions = ois.readInt(); int numFunctionBundles = ois.readInt(); double[][][] hashFunctions = new double[numFunctionBundles][bits][dimensions]; for (int i = 0; i < hashFunctions.length; i++) { double[][] functionBundle = hashFunctions[i]; for (int j = 0; j < functionBundle.length; j++) { double[] bitFunctions = functionBundle[j]; for (int k = 0; k < bitFunctions.length; k++) { bitFunctions[k] = ois.readFloat(); } } } BitSampling.hashes = hashFunctions; return hashFunctions; }