Class VectorFileIterators.FloatVectorFileIterator

java.lang.Object
uk.co.parnmatt.vector.util.PrefetchingIterator<float[]>
uk.co.parnmatt.vector.reader.VectorFileIterators.FloatVectorFileIterator
All Implemented Interfaces:
AutoCloseable, Iterator<float[]>, Resource<IOException>, Resource.Iterator<float[], IOException>
Enclosing class:
VectorFileIterators

public static final class VectorFileIterators.FloatVectorFileIterator extends PrefetchingIterator<float[]>
Represents an iterator of float vector from a file
  • Constructor Details

    • FloatVectorFileIterator

      public FloatVectorFileIterator(Path path, Options options) throws IOException
      Parameters:
      path - the path to the file which to read
      options - the options to configure the read buffer
      Throws:
      IOException
  • Method Details

    • componentBytes

      protected int componentBytes()
      Returns:
      number of bytes of the array component representation
    • get

      protected float[] get(int dimensions, ByteBuffer buffer)
      Get a vector of the provided dimensions read from buffer
      Parameters:
      dimensions - the dimensions of the vector
      buffer - the buffer holding the raw vector data
      Returns:
      the vector of provided dimensions
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Resource<E>
      Throws:
      IOException
    • fetch

      protected float[] fetch()
      Specified by:
      fetch in class PrefetchingIterator<E>
      Returns:
      the next element in the iteration, or null to indicate the end of the iterator