Class FSDirectory.FSIndexOutput

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Enclosing class:
    FSDirectory

    protected static class FSDirectory.FSIndexOutput
    extends BufferedIndexOutput
    Writes output with RandomAccessFile.write(byte[], int, int)
    • Constructor Detail

      • FSIndexOutput

        public FSIndexOutput​(FSDirectory parent,
                             java.lang.String name)
                      throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • flushBuffer

        protected void flushBuffer​(byte[] b,
                                   int offset,
                                   int size)
                            throws java.io.IOException
        Description copied from class: BufferedIndexOutput
        Expert: implements buffer write. Writes bytes at the current position in the output.
        Specified by:
        flushBuffer in class BufferedIndexOutput
        Parameters:
        b - the bytes to write
        offset - the offset in the byte array
        size - the number of bytes to write
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: IndexOutput
        Closes this stream to further operations.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class BufferedIndexOutput
        Throws:
        java.io.IOException
      • length

        public long length()
                    throws java.io.IOException
        Description copied from class: IndexOutput
        The number of bytes in the file.
        Specified by:
        length in class BufferedIndexOutput
        Throws:
        java.io.IOException
      • setLength

        public void setLength​(long length)
                       throws java.io.IOException
        Description copied from class: IndexOutput
        Set the file length. By default, this method does nothing (it's optional for a Directory to implement it). But, certain Directory implementations (for example @see FSDirectory) can use this to inform the underlying IO system to pre-allocate the file to the specified size. If the length is longer than the current file length, the bytes added to the file are undefined. Otherwise the file is truncated.
        Overrides:
        setLength in class IndexOutput
        Parameters:
        length - file length
        Throws:
        java.io.IOException