Class AbstractGeomReader

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int canReadData​(java.io.File inputFile)
      Method that determines if this reader can read geometry from the specified input file.
      boolean canWriteData()
      Returns true if this class can write at least some data in the format supported by this class.
      int compareTo​(java.lang.Object o)
      Compares this object with the specified object for order based on the toString().compareTo(o.toString()) method.
      java.util.List<java.lang.String> getWarnings()
      Return a list of any warning messages that the reader/writer may have issued.
      GeometryList read​(java.io.File inputFile)
      Reads in a geometry file from the supplied input file and returns a GeometryList object that contains the geometry from the file.
      void setFileUnits​(javax.measure.unit.Unit<javax.measure.quantity.Length> units)
      Sets the units used for the geometry as stored in a non-unit aware geometry file being read in.
      void write​(java.io.File outputFile, GeometryList geometry)
      Writes out a geometry file for the geometry contained in the supplied GeometryList object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • compareTo

        public int compareTo​(java.lang.Object o)
        Compares this object with the specified object for order based on the toString().compareTo(o.toString()) method. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Specified by:
        compareTo in interface java.lang.Comparable
      • canReadData

        public int canReadData​(java.io.File inputFile)
                        throws java.io.IOException
        Method that determines if this reader can read geometry from the specified input file. This implementation always returns NO.
        Specified by:
        canReadData in interface GeomReader
        Parameters:
        inputFile - The input file containing the geometry to be read in.
        Returns:
        GeomReader.YES if this class can definitely read the file, GeomReader.MAYBE if the file could possibly be read and GeomReader.NO if the file can definitely not be read by this class.
        Throws:
        java.io.IOException - Could be thrown by sub-classes and indicates that the file can not be read by this reader.
      • canWriteData

        public boolean canWriteData()
        Returns true if this class can write at least some data in the format supported by this class. Returns false if it can not.

        This default implementation always returns false.

        Specified by:
        canWriteData in interface GeomReader
        Returns:
        true if this class can write at least some data in the format supported by this class.
      • read

        public GeometryList read​(java.io.File inputFile)
                          throws java.io.IOException
        Reads in a geometry file from the supplied input file and returns a GeometryList object that contains the geometry from the file.

        WARNING! This method must be implemented by sub-classes and this implementation will throw an exception if you try and use it.

        Specified by:
        read in interface GeomReader
        Parameters:
        inputFile - The input file containing the geometry to be read in.
        Returns:
        A GeometryList object containing the geometry read in from the file.
        Throws:
        java.io.IOException - If there is a problem reading the specified file.
        See Also:
        setFileUnits(javax.measure.unit.Unit)
      • getWarnings

        public java.util.List<java.lang.String> getWarnings()
        Return a list of any warning messages that the reader/writer may have issued.
        Specified by:
        getWarnings in interface GeomReader
        Returns:
        A list of any warning messages that the reader/writer may have issued.
      • write

        public void write​(java.io.File outputFile,
                          GeometryList geometry)
                   throws java.io.IOException
        Writes out a geometry file for the geometry contained in the supplied GeometryList object.

        WARNING! This method must be implemented by sub-classes and this implementation will throw an exception if you try and use it.

        Specified by:
        write in interface GeomReader
        Parameters:
        outputFile - The output File to which the geometry is to be written.
        geometry - The GeometryList object containing the geometry to be written out.
        Throws:
        java.io.IOException - If there is a problem writing to the specified file.
      • setFileUnits

        public void setFileUnits​(javax.measure.unit.Unit<javax.measure.quantity.Length> units)
        Sets the units used for the geometry as stored in a non-unit aware geometry file being read in. The geometry is returned in these units for file types which are not unit aware. If the file format specifies units, the input from this method will be ignored. If this method is not called before reading a non-unit aware geometry file, then the units of the returned geometry will be the system default units. When writing out geometry, this is ignored.
        Specified by:
        setFileUnits in interface GeomReader
        Parameters:
        units - The units used for the geometry in the file being read in. If null is passed, the units will default to the default system units.
        See Also:
        GeomReader.isUnitAware()