Class TableFile

  • All Implemented Interfaces:
    java.io.Serializable

    public class TableFile
    extends java.lang.Object
    implements java.io.Serializable
    Load a table from a file. The table is loaded into an arbitrary object having arrays to hold the data.
    Author:
    pcingola
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static char FIELD_NAME_SEPARATOR  
      protected java.util.HashMap<java.lang.String,​java.lang.reflect.Field> fieldByName  
      protected java.lang.String[] fieldNames  
      protected java.lang.String fieldStr  
      protected java.lang.String fileName  
      protected boolean hasTitle  
      protected java.lang.String separator  
      protected int size  
      protected boolean verbose  
    • Constructor Summary

      Constructors 
      Constructor Description
      TableFile​(int size)  
      TableFile​(java.lang.String fileName)  
      TableFile​(java.lang.String fileName, java.lang.String fieldStr)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void assign​(java.lang.String line, int idx)
      Assign values parse from 'line' into array elements indexed by 'idx'
      protected void initFields()
      Map field names to Field objects
      void load()
      Load all data into memory
      void save​(java.lang.String binaryFile)
      Save this object to a binary file (using Java serialization)
      int size()
      Array size
      java.lang.String toString​(int index)
      Return line number 'index' as a string
      • Methods inherited from class java.lang.Object

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

      • size

        protected int size
      • verbose

        protected boolean verbose
      • hasTitle

        protected boolean hasTitle
      • fileName

        protected java.lang.String fileName
      • separator

        protected java.lang.String separator
      • fieldStr

        protected java.lang.String fieldStr
      • fieldNames

        protected java.lang.String[] fieldNames
      • fieldByName

        protected java.util.HashMap<java.lang.String,​java.lang.reflect.Field> fieldByName
    • Constructor Detail

      • TableFile

        public TableFile​(int size)
      • TableFile

        public TableFile​(java.lang.String fileName)
      • TableFile

        public TableFile​(java.lang.String fileName,
                         java.lang.String fieldStr)
    • Method Detail

      • assign

        protected void assign​(java.lang.String line,
                              int idx)
        Assign values parse from 'line' into array elements indexed by 'idx'
        Parameters:
        line -
        idx -
      • initFields

        protected void initFields()
        Map field names to Field objects
      • load

        public void load()
        Load all data into memory
      • save

        public void save​(java.lang.String binaryFile)
        Save this object to a binary file (using Java serialization)
        Parameters:
        binaryFile -
      • size

        public int size()
        Array size
        Returns:
      • toString

        public java.lang.String toString​(int index)
        Return line number 'index' as a string
        Parameters:
        index -
        Returns: