Class OfflinePointWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, PointWriter

    public final class OfflinePointWriter
    extends java.lang.Object
    implements PointWriter
    Writes points to disk in a fixed-with format.
    • Constructor Summary

      Constructors 
      Constructor Description
      OfflinePointWriter​(Directory tempDir, java.lang.String tempFileNamePrefix, int packedBytesLength, java.lang.String desc, long expectedCount)
      Create a new writer with an unknown number of incoming points
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(byte[] packedValue, int docID)
      Add a new point from the packed value and docId
      void append​(PointValue pointValue)
      Add a new point from a PointValue
      void close()  
      long count()
      Return the number of points in this writer
      void destroy()
      Removes any temp files behind this writer
      PointReader getReader​(long start, long length)
      Returns a PointReader iterator to step through all previously added points
      protected OfflinePointReader getReader​(long start, long length, byte[] reusableBuffer)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        public final java.lang.String name
      • packedBytesLength

        final int packedBytesLength
      • count

        long count
      • closed

        private boolean closed
      • expectedCount

        final long expectedCount
    • Constructor Detail

      • OfflinePointWriter

        public OfflinePointWriter​(Directory tempDir,
                                  java.lang.String tempFileNamePrefix,
                                  int packedBytesLength,
                                  java.lang.String desc,
                                  long expectedCount)
                           throws java.io.IOException
        Create a new writer with an unknown number of incoming points
        Throws:
        java.io.IOException
    • Method Detail

      • append

        public void append​(byte[] packedValue,
                           int docID)
                    throws java.io.IOException
        Description copied from interface: PointWriter
        Add a new point from the packed value and docId
        Specified by:
        append in interface PointWriter
        Throws:
        java.io.IOException
      • append

        public void append​(PointValue pointValue)
                    throws java.io.IOException
        Description copied from interface: PointWriter
        Add a new point from a PointValue
        Specified by:
        append in interface PointWriter
        Throws:
        java.io.IOException
      • getReader

        public PointReader getReader​(long start,
                                     long length)
                              throws java.io.IOException
        Description copied from interface: PointWriter
        Returns a PointReader iterator to step through all previously added points
        Specified by:
        getReader in interface PointWriter
        Throws:
        java.io.IOException
      • getReader

        protected OfflinePointReader getReader​(long start,
                                               long length,
                                               byte[] reusableBuffer)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • count

        public long count()
        Description copied from interface: PointWriter
        Return the number of points in this writer
        Specified by:
        count in interface PointWriter
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • destroy

        public void destroy()
                     throws java.io.IOException
        Description copied from interface: PointWriter
        Removes any temp files behind this writer
        Specified by:
        destroy in interface PointWriter
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object