Package geomss.geom.reader
Class XGSSGeomReader
- java.lang.Object
-
- geomss.geom.reader.AbstractGeomReader
-
- geomss.geom.reader.XGSSGeomReader
-
- All Implemented Interfaces:
GeomReader
,java.lang.Comparable
public class XGSSGeomReader extends AbstractGeomReader
AGeomReader
for reading geometry from an XGSS formatted, GZIP compressed, XML geometry file. XGSS is the native file format for GeomSS.Modified by: Joseph A. Huwaldt
- Version:
- September 9, 2016
- Author:
- Joseph A. Huwaldt, Date: June 20, 2013
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXTENSION
The preferred file extension for files of this reader's type.-
Fields inherited from interface geomss.geom.reader.GeomReader
MAYBE, NO, YES
-
-
Constructor Summary
Constructors Constructor Description XGSSGeomReader()
-
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()
Returnstrue
.java.lang.String
getExtension()
Returns the preferred file extension (not including the ".") for files of this GeomReader's type.boolean
isUnitAware()
This method always returnstrue
as XGSS files do encode the units that are being used for each geometry element.GeometryList
read(java.io.File inputFile)
Reads in an XGSS geometry file from the specified input file and returns aGeometryList
object that contains the geometry from the file.java.util.Map<java.lang.String,java.lang.Object>
readWorkspace(java.io.File inputFile)
Reads in an XGSS geometry + workspace file from the specified input file and returns a Map object that contains the geometry and workspace variables from the file with the variable names as the keys.java.lang.String
toString()
Returns a string representation of the object.void
write(java.io.File outputFile, GeometryList geometry)
Writes out a geometry file for the geometry contained in the suppliedGeometryList
object.void
write(java.io.File outputFile, java.util.Map<java.lang.String,GeomElement> geometry, java.util.Map<java.lang.String,java.lang.Object> vars)
Writes out an XGSS geometry file for the and non-geometry workspace variables contained in the supplied maps.-
Methods inherited from class geomss.geom.reader.AbstractGeomReader
compareTo, getWarnings, setFileUnits
-
-
-
-
Field Detail
-
EXTENSION
public static final java.lang.String EXTENSION
The preferred file extension for files of this reader's type.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XGSSGeomReader
public XGSSGeomReader()
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a string representation of the object. This will return a brief description of the format read by this reader.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A brief description of the format read by this reader.
-
getExtension
public java.lang.String getExtension()
Returns the preferred file extension (not including the ".") for files of this GeomReader's type.- Returns:
- The preferred file extension for files of this readers type.
-
isUnitAware
public boolean isUnitAware()
This method always returnstrue
as XGSS files do encode the units that are being used for each geometry element.- Returns:
- This method always returns true.
- See Also:
GeomReader.setFileUnits(javax.measure.unit.Unit)
-
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.- Specified by:
canReadData
in interfaceGeomReader
- Overrides:
canReadData
in classAbstractGeomReader
- Parameters:
inputFile
- The input file containing the geometry to be read in.- Returns:
- GeomReader.NO if the file format is not recognized by this reader. GeomReader.YES if the file format is definitely recognized by this reader. GeomReader.MAYBE if the file format might be readable by this reader, but that can't easily be determined without actually reading the file.
- Throws:
java.io.IOException
- If there is a problem reading from the specified file.
-
read
public GeometryList read(java.io.File inputFile) throws java.io.IOException
Reads in an XGSS geometry file from the specified input file and returns aGeometryList
object that contains the geometry from the file.- Specified by:
read
in interfaceGeomReader
- Overrides:
read
in classAbstractGeomReader
- Parameters:
inputFile
- The input file containing the geometry to be read in. May not be null.- Returns:
- A
GeometryList
object containing the geometry read in from the file. If the file has no readable geometry in it, then this list will have no elements in it (will have a size() of 0). - Throws:
java.io.IOException
- If there is a problem reading the specified file.- See Also:
AbstractGeomReader.setFileUnits(javax.measure.unit.Unit)
-
canWriteData
public boolean canWriteData()
Returnstrue
. This reader can write all geometry element types to an XGSS file.- Specified by:
canWriteData
in interfaceGeomReader
- Overrides:
canWriteData
in classAbstractGeomReader
- Returns:
- This method always returns true.
-
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 suppliedGeometryList
object.- Specified by:
write
in interfaceGeomReader
- Overrides:
write
in classAbstractGeomReader
- Parameters:
outputFile
- The output File to which the geometry is to be written. May not be null.geometry
- TheGeometryList
object containing the geometry to be written out. May not be null.- Throws:
java.io.IOException
- If there is a problem writing to the specified file.
-
write
public void write(java.io.File outputFile, java.util.Map<java.lang.String,GeomElement> geometry, java.util.Map<java.lang.String,java.lang.Object> vars) throws java.io.IOException
Writes out an XGSS geometry file for the and non-geometry workspace variables contained in the supplied maps.- Parameters:
outputFile
- The output File to which the geometry is to be written. May not be null.geometry
- A map identifying geometry elements by their associated variable names. May not be null.vars
- A map identifying non-geometry related workspace variables by their variable names. May not be null.- Throws:
java.io.IOException
- If there is a problem writing to the specified file.
-
readWorkspace
public java.util.Map<java.lang.String,java.lang.Object> readWorkspace(java.io.File inputFile) throws java.io.IOException
Reads in an XGSS geometry + workspace file from the specified input file and returns a Map object that contains the geometry and workspace variables from the file with the variable names as the keys.- Parameters:
inputFile
- The input file containing the geometry + workspace to be read in.- Returns:
- A Map object containing the geometry and workspace variables read in from the file with the variable names as the keys. If the file has no readable geometry in it, then this map will have no contents.
- Throws:
java.io.IOException
- If there is a problem reading the specified file.
-
-