Class GPEParser

java.lang.Object
org.gvsig.gpe.lib.impl.parser.GPEParser
All Implemented Interfaces:
IGPEParser

public abstract class GPEParser extends Object implements IGPEParser
This class has to be inherited by all the classes that implements a parser for a geographical format. IT has methods to indicate the formats and the versions that is able to parse.
Author:
Jorge Piera Llodrá (jorge.piera@iver.es), Carlos Sánchez Periñán (sanchez_carper@gva.es)
  • Constructor Details

    • GPEParser

      public GPEParser()
      All the GPE parser must implement an empty constructor
  • Method Details

    • parse

      public void parse(IGPEContentHandlerInmGeom contents, IGPEErrorHandler errors, URI uri)
      Method to parse a file. It cannot to throw any exception and it cannot to return any value. In a future it could be implemented like a independent thread
      Specified by:
      parse in interface IGPEParser
      Parameters:
      contents - Application ContentHandler
      errors - Application ErrorsHandler
      uri - File to open
      Throws:
      Exception
    • parseURI

      protected abstract void parseURI()
      Parses the file from a URI
    • parse

      public void parse(IGPEContentHandlerInmGeom contents, IGPEErrorHandler errors, InputStream is)
      Method to parse an InputStream. It cannot to throw any exception and it cannot to return any value. In a future it could be implemented like a independent thread
      Specified by:
      parse in interface IGPEParser
      Parameters:
      contents - Application ContentHandler
      errors - Application ErrorsHandler
      is - The input stream
      Throws:
      Exception
    • parseStream

      protected abstract void parseStream()
      Parses the file from an input stream
    • accept

      public abstract boolean accept(URI uri)
      Return if the driver can open the file
      Specified by:
      accept in interface IGPEParser
      Parameters:
      uri - File to open
      Returns:
      True if the driver is able to open it
    • accept

      public abstract boolean accept(File file)
      Return if the driver can open the file
      Parameters:
      uri - File to open
      Returns:
      True if the driver is able to open it
    • getFormat

      public abstract String getFormat()
      Return the format that the driver is able to read
      Specified by:
      getFormat in interface IGPEParser
      Returns:
    • getContentHandler

      public IGPEContentHandlerInmGeom getContentHandler()
      Specified by:
      getContentHandler in interface IGPEParser
      Returns:
      the contentHandler
    • getErrorHandler

      public IGPEErrorHandler getErrorHandler()
      Specified by:
      getErrorHandler in interface IGPEParser
      Returns:
      the errorHandler
    • getMainFile

      public URI getMainFile()
      Specified by:
      getMainFile in interface IGPEParser
      Returns:
      the file
    • getDescription

      public abstract String getDescription()
      Specified by:
      getDescription in interface IGPEParser
      Returns:
      the description
    • getName

      public abstract String getName()
      Specified by:
      getName in interface IGPEParser
      Returns:
      the name
    • getInputStream

      protected InputStream getInputStream()
      Returns:
      the is
    • setInputStream

      protected void setInputStream(InputStream is)
      We need to find a better way to reuse or coupling parsers. This method was introduced for the SLD parsing to grab a single geometry from a filter.
      Parameters:
      is - the is to set
    • setErrorHandler

      public void setErrorHandler(IGPEErrorHandler errorHandler)
      Specified by:
      setErrorHandler in interface IGPEParser
      Parameters:
      errorHandler - the errorHandler to set
    • setContentHandler

      public void setContentHandler(IGPEContentHandlerInmGeom contentHandler)
      Specified by:
      setContentHandler in interface IGPEParser
      Parameters:
      contentHandler - the contentHandler to set
    • getGpeManager

      public GPEManager getGpeManager()
      Returns:
      the gpeManager