Class FSArrayFile<V extends org.apache.hadoop.io.Writable>

  • Type Parameters:
    V - Type of Writable
    All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable<V>, java.util.Collection<V>, java.util.List<V>
    Direct Known Subclasses:
    FSADocumentIndex, FSArrayFileInMem

    public class FSArrayFile<V extends org.apache.hadoop.io.Writable>
    extends java.util.AbstractList<V>
    implements java.io.Closeable
    A file for accessing Writable classes written on disk. These must be of fixed size. This implementation is read-only, but does implement the List interface.
    Since:
    3.0
    Author:
    Craig Macdonald
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      V get​(int entryNumber)  
      java.util.Iterator<V> iterator()  
      int size()  
      static FSArrayFile.ArrayFileWriter writeFSArrayFile​(java.lang.String filename)
      writeFSArrayFile
      • Methods inherited from class java.util.AbstractList

        add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Field Detail

      • USUAL_EXTENSION

        public static final java.lang.String USUAL_EXTENSION
        USUAL_EXTENSION
        See Also:
        Constant Field Values
      • numberOfEntries

        protected int numberOfEntries
        The number of entries in the file.
      • entrySize

        protected int entrySize
        total size of one key,value pair
      • dataFilename

        protected java.lang.String dataFilename
        filename of the underlying file
    • Constructor Detail

      • FSArrayFile

        protected FSArrayFile()
      • FSArrayFile

        public FSArrayFile​(IndexOnDisk index,
                           java.lang.String structureName)
                    throws java.io.IOException
        constructor
        Parameters:
        index -
        structureName -
        Throws:
        java.io.IOException
      • FSArrayFile

        public FSArrayFile​(java.lang.String filename,
                           boolean updateable,
                           FixedSizeWriteableFactory<V> _valueFactory)
                    throws java.io.IOException
        default constructor
        Parameters:
        filename -
        updateable -
        _valueFactory -
        Throws:
        java.io.IOException
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<V extends org.apache.hadoop.io.Writable>
        Specified by:
        size in interface java.util.List<V extends org.apache.hadoop.io.Writable>
        Specified by:
        size in class java.util.AbstractCollection<V extends org.apache.hadoop.io.Writable>
      • get

        public V get​(int entryNumber)
        Specified by:
        get in interface java.util.List<V extends org.apache.hadoop.io.Writable>
        Specified by:
        get in class java.util.AbstractList<V extends org.apache.hadoop.io.Writable>
      • iterator

        public java.util.Iterator<V> iterator()
        Specified by:
        iterator in interface java.util.Collection<V extends org.apache.hadoop.io.Writable>
        Specified by:
        iterator in interface java.lang.Iterable<V extends org.apache.hadoop.io.Writable>
        Specified by:
        iterator in interface java.util.List<V extends org.apache.hadoop.io.Writable>
        Overrides:
        iterator in class java.util.AbstractList<V extends org.apache.hadoop.io.Writable>
      • writeFSArrayFile

        public static FSArrayFile.ArrayFileWriter writeFSArrayFile​(java.lang.String filename)
                                                            throws java.io.IOException
        writeFSArrayFile
        Parameters:
        filename -
        Returns:
        fixed size array file
        Throws:
        java.io.IOException
      • 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