Class VectorFileIterators
java.lang.Object
uk.co.parnmatt.vector.reader.VectorFileIterators
Reads binary encoded vectors from files with default buffering.
try (CloseableIterator<float[]> vectors = VectorFileIterators.floats(path)) {
while (vectors.hasNext()) {
float[] vector = vectors.next();
// process vector
}
}
For control over the source, buffering strategy, and byte order, compose a reader
with VectorReader.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic CloseableIterator<byte[]> Readsbytevectors from a filestatic CloseableIterator<double[]> Readsdoublevectors from a filestatic CloseableIterator<float[]> Readsfloatvectors from a filestatic CloseableIterator<int[]> Readsintvectors from a filestatic CloseableIterator<long[]> Readslongvectors from a filestatic CloseableIterator<short[]> Readsshortvectors from a file
-
Method Details
-
bytes
Readsbytevectors from a file- Parameters:
path- the path to the file which to read- Returns:
- a closeable iterator over the file's
bytevectors - Throws:
IOException- Since:
- 0.4.0
- See Also:
-
shorts
Readsshortvectors from a file- Parameters:
path- the path to the file which to read- Returns:
- a closeable iterator over the file's
shortvectors - Throws:
IOException- Since:
- 0.4.0
- See Also:
-
ints
Readsintvectors from a file- Parameters:
path- the path to the file which to read- Returns:
- a closeable iterator over the file's
intvectors - Throws:
IOException- Since:
- 0.4.0
- See Also:
-
longs
Readslongvectors from a file- Parameters:
path- the path to the file which to read- Returns:
- a closeable iterator over the file's
longvectors - Throws:
IOException- Since:
- 0.4.0
- See Also:
-
floats
Readsfloatvectors from a file- Parameters:
path- the path to the file which to read- Returns:
- a closeable iterator over the file's
floatvectors - Throws:
IOException- Since:
- 0.4.0
- See Also:
-
doubles
Readsdoublevectors from a file- Parameters:
path- the path to the file which to read- Returns:
- a closeable iterator over the file's
doublevectors - Throws:
IOException- Since:
- 0.4.0
- See Also:
-