Class MappedFrontCodedStringBigList

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MappedFrontCodedStringBigList.PropertyKeys  
      • Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectBigList

        it.unimi.dsi.fastutil.objects.AbstractObjectBigList.ObjectRandomAccessSubList<K extends java.lang.Object>, it.unimi.dsi.fastutil.objects.AbstractObjectBigList.ObjectSubList<K extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BYTE_ARRAY_EXTENSION  
      protected it.unimi.dsi.fastutil.bytes.ByteBigList byteList
      The underlying byte array.
      protected long n
      The number of strings in the list.
      protected it.unimi.dsi.fastutil.longs.LongBigList pointers
      The pointers to entire arrays in the list.
      static java.lang.String POINTERS_EXTENSION  
      static java.lang.String PROPERTIES_EXTENSION  
      protected int ratio
      The ratio of this front-coded list.
      static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MappedFrontCodedStringBigList​(long n, int ratio, java.lang.String byteBigList, java.lang.String pointers)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void build​(java.lang.String basename, int ratio, java.util.Iterator<byte[]> arrays)
      Builds and stores a new memory-mapped front-coded big string list.
      void close()  
      MappedFrontCodedStringBigList copy()
      Returns a copy of this object, sharing state with this object as much as possible.
      protected static int countUTF8Chars​(byte[] a)  
      MutableString get​(long index)
      Returns the element at the specified position in this front-coded big list as a mutable string.
      void get​(long index, MutableString s)
      Returns the element at the specified position in this front-coded big list by storing it in a mutable string.
      byte[] getArray​(long index)
      Returns the element at the specified position in this front-coded big list as an UTF-8-coded byte array.
      java.lang.String getString​(long index)
      Returns the element at the specified position in this front-coded big list as a string.
      static MappedFrontCodedStringBigList load​(java.lang.String basename)
      Maps in memory a front-coded string big list starting from a basename.
      static void main​(java.lang.String[] arg)  
      long size64()  
      • Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectBigList

        add, add, addAll, addAll, addElements, addElements, clear, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, forEach, getElements, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, peek, pop, push, remove, removeElements, set, setElements, size, size, subList, top, toString
      • Methods inherited from class java.util.AbstractCollection

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

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

        containsAll, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, stream, toArray, toArray, toArray
      • Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectBigList

        addAll, addAll, addAll, addAll, getElements, setElements, setElements, spliterator
      • Methods inherited from interface it.unimi.dsi.fastutil.Stack

        isEmpty
    • Field Detail

      • PROPERTIES_EXTENSION

        public static final java.lang.String PROPERTIES_EXTENSION
        See Also:
        Constant Field Values
      • BYTE_ARRAY_EXTENSION

        public static final java.lang.String BYTE_ARRAY_EXTENSION
        See Also:
        Constant Field Values
      • POINTERS_EXTENSION

        public static final java.lang.String POINTERS_EXTENSION
        See Also:
        Constant Field Values
      • n

        protected final long n
        The number of strings in the list.
      • ratio

        protected final int ratio
        The ratio of this front-coded list.
      • byteList

        protected it.unimi.dsi.fastutil.bytes.ByteBigList byteList
        The underlying byte array.
      • pointers

        protected it.unimi.dsi.fastutil.longs.LongBigList pointers
        The pointers to entire arrays in the list.
    • Constructor Detail

      • MappedFrontCodedStringBigList

        protected MappedFrontCodedStringBigList​(long n,
                                                int ratio,
                                                java.lang.String byteBigList,
                                                java.lang.String pointers)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • build

        public static void build​(java.lang.String basename,
                                 int ratio,
                                 java.util.Iterator<byte[]> arrays)
                          throws java.io.IOException,
                                 org.apache.commons.configuration2.ex.ConfigurationException
        Builds and stores a new memory-mapped front-coded big string list.

        Given a basename, three file with extensions PROPERTIES_EXTENSION, BYTE_ARRAY_EXTENSION and POINTERS_EXTENSION will be generated.

        After building a list, you can load it using the same basename.

        Parameters:
        basename - the basename of the list.
        ratio - the ratio.
        arrays - an iterator over byte arrays containing UTF-8 encoded-strings.
        Throws:
        java.io.IOException
        org.apache.commons.configuration2.ex.ConfigurationException
      • load

        public static MappedFrontCodedStringBigList load​(java.lang.String basename)
                                                  throws org.apache.commons.configuration2.ex.ConfigurationException,
                                                         java.io.IOException
        Maps in memory a front-coded string big list starting from a basename.
        Parameters:
        basename - the basename of a memory-mapped front-coded string big list.
        Returns:
        a memory-mapped front-coded string big list.
        Throws:
        org.apache.commons.configuration2.ex.ConfigurationException
        java.io.IOException
      • get

        public MutableString get​(long index)
        Returns the element at the specified position in this front-coded big list as a mutable string.
        Specified by:
        get in interface it.unimi.dsi.fastutil.BigList<MutableString>
        Parameters:
        index - an index in the list.
        Returns:
        a MutableString that will contain the string at the specified position. The string may be freely modified.
      • get

        public void get​(long index,
                        MutableString s)
        Returns the element at the specified position in this front-coded big list by storing it in a mutable string.
        Parameters:
        index - an index in the list.
        s - a mutable string that will contain the string at the specified position.
      • getString

        public java.lang.String getString​(long index)
        Returns the element at the specified position in this front-coded big list as a string.
        Parameters:
        index - an index in the list.
        Returns:
        a String that will contain the string at the specified position.
      • getArray

        public byte[] getArray​(long index)
        Returns the element at the specified position in this front-coded big list as an UTF-8-coded byte array.
        Parameters:
        index - an index in the list.
        Returns:
        a byte array representing in UTF-8 encoding the string at the specified position.
      • countUTF8Chars

        protected static int countUTF8Chars​(byte[] a)
      • size64

        public long size64()
        Specified by:
        size64 in interface it.unimi.dsi.fastutil.Size64
      • 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
      • main

        public static void main​(java.lang.String[] arg)
                         throws java.io.IOException,
                                com.martiansoftware.jsap.JSAPException,
                                org.apache.commons.configuration2.ex.ConfigurationException,
                                java.lang.ClassNotFoundException,
                                java.lang.IllegalArgumentException,
                                java.lang.SecurityException
        Throws:
        java.io.IOException
        com.martiansoftware.jsap.JSAPException
        org.apache.commons.configuration2.ex.ConfigurationException
        java.lang.ClassNotFoundException
        java.lang.IllegalArgumentException
        java.lang.SecurityException