Class AttributeTable

  • All Implemented Interfaces:
    java.lang.Cloneable


    public final class AttributeTable
    extends java.lang.Object
    implements java.lang.Cloneable
    Attribute table of shape file
    • Constructor Summary

      Constructors 
      Constructor Description
      AttributeTable​()
      Constructor
      AttributeTable​(java.lang.String filename)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone​()
      Clone
      void fill​(int numRows)
      This populates the Table with data from the file.
      java.lang.String getEncoding​()
      Get encoding string
      java.io.File getFile​()
      Get file
      int getNumRecords​()
      Get record number
      DataTable getTable​()
      Get data table
      void open​(java.lang.String filename)
      Reads all the information from the file, including the vector shapes and the database component.
      void openDBF​(java.lang.String fileName)
      Reads all the information from the dBase file, including the vector shapes and the database component.
      void save​()
      Save the file
      void save​(java.lang.String fileName)
      Save the file
      void saveAs​(java.lang.String fileName, boolean overwrite)
      Save this table to the specified file name
      void setEncoding​(java.lang.String value)
      Set encoding string
      void setTable​(DataTable table)
      Set data table
      void updateDataTable​()
      Update data table - convert DataColumn to Field
      void writeHeader​(EndianDataOutputStream writer)
      Write the header data to the DBF file
      void writeTable​()
      This appends the content of one datarow to a DBF file
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AttributeTable

        public AttributeTable​()
        Constructor
      • AttributeTable

        public AttributeTable​(java.lang.String filename)
                       throws java.io.FileNotFoundException,
                              java.io.IOException,
                              java.lang.Exception
        Constructor
        Parameters:
        filename - The file name
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
        java.lang.Exception
    • Method Detail

      • getFile

        public java.io.File getFile​()
        Get file
        Returns:
        File
      • getNumRecords

        public int getNumRecords​()
        Get record number
        Returns:
        Record number
      • getTable

        public DataTable getTable​()
        Get data table
        Returns:
        The data table
      • setTable

        public void setTable​(DataTable table)
        Set data table
        Parameters:
        table - The data table
      • getEncoding

        public java.lang.String getEncoding​()
        Get encoding string
        Returns:
        Encoding string
      • setEncoding

        public void setEncoding​(java.lang.String value)
        Set encoding string
        Parameters:
        value - Encoding string
      • updateDataTable

        public void updateDataTable​()
        Update data table - convert DataColumn to Field
      • open

        public void open​(java.lang.String filename)
                  throws java.io.FileNotFoundException,
                         java.io.IOException,
                         java.lang.Exception
        Reads all the information from the file, including the vector shapes and the database component.
        Parameters:
        filename - The file name
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
        java.lang.Exception
      • openDBF

        public void openDBF​(java.lang.String fileName)
                     throws java.io.FileNotFoundException,
                            java.io.IOException,
                            java.lang.Exception
        Reads all the information from the dBase file, including the vector shapes and the database component.
        Parameters:
        fileName - The dBase file name
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
        java.lang.Exception
      • fill

        public void fill​(int numRows)
                  throws java.io.FileNotFoundException,
                         java.io.IOException,
                         java.lang.Exception
        This populates the Table with data from the file.
        Parameters:
        numRows - In the event that the dbf file is not found, this indicates how many blank rows should exist in the attribute Table.
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
        java.lang.Exception
      • save

        public void save​()
        Save the file
      • save

        public void save​(java.lang.String fileName)
        Save the file
        Parameters:
        fileName - File name
      • saveAs

        public void saveAs​(java.lang.String fileName,
                           boolean overwrite)
        Save this table to the specified file name
        Parameters:
        fileName - The file name to be saved
        overwrite - If over write the file if it exists
      • writeHeader

        public void writeHeader​(EndianDataOutputStream writer)
                         throws java.io.IOException
        Write the header data to the DBF file
        Parameters:
        writer - The writer stream
        Throws:
        java.io.IOException - IO exception
      • writeTable

        public void writeTable​()
                        throws java.io.IOException
        This appends the content of one datarow to a DBF file
        Throws:
        java.io.IOException
      • clone

        public java.lang.Object clone​()
        Clone
        Overrides:
        clone in class java.lang.Object
        Returns:
        AttributeTable object