Class IndexOutput

    • Constructor Detail

      • IndexOutput

        protected IndexOutput​(String resourceDescription,
                              String name)
        Sole constructor. resourceDescription should be non-null, opaque string describing this resource; it's returned from toString().
    • Method Detail

      • getFilePointer

        public abstract long getFilePointer()
        Returns the current position in this file, where the next write will occur.
      • getChecksum

        public abstract long getChecksum()
                                  throws IOException
        Returns the current checksum of bytes written so far
      • alignFilePointer

        public final long alignFilePointer​(int alignmentBytes)
                                    throws IOException
        Aligns the current file pointer to multiples of alignmentBytes bytes to improve reads with mmap. This will write between 0 and (alignmentBytes-1) zero bytes using DataOutput.writeByte(byte).
        alignmentBytes - the alignment to which it should forward file pointer (must be a power of 2)
        the new file pointer after alignment
        See Also:
        alignOffset(long, int)
      • alignOffset

        public static final long alignOffset​(long offset,
                                             int alignmentBytes)
        Aligns the given offset to multiples of alignmentBytes bytes by rounding up. The alignment must be a power of 2.