Package org.goplanit.gtfs.reader
Class GtfsFileReaderBase
- java.lang.Object
-
- org.goplanit.gtfs.reader.GtfsFileReaderBase
-
- Direct Known Subclasses:
GtfsFileReaderAgencies
,GtfsFileReaderAttributions
,GtfsFileReaderCalendarDates
,GtfsFileReaderCalendars
,GtfsFileReaderFareAttributes
,GtfsFileReaderFareRules
,GtfsFileReaderFeedInfo
,GtfsFileReaderFrequencies
,GtfsFileReaderLevels
,GtfsFileReaderPathways
,GtfsFileReaderRoutes
,GtfsFileReaderShapes
,GtfsFileReaderStops
,GtfsFileReaderStopTimes
,GtfsFileReaderTransfers
,GtfsFileReaderTranslations
,GtfsFileReaderTrips
public abstract class GtfsFileReaderBase extends Object
A GTFS file reader containing generic code for any GTFS file- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation)
Constructor using default gtfs reader settingsprotected
GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation, GtfsFileReaderSettings settings)
Constructor which enforces the file to be presentprotected
GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation, GtfsFileConditions filePresenceCondition)
Constructor using default gtfs reader settingsprotected
GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation, GtfsFileConditions filePresenceCondition, GtfsFileReaderSettings settings)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(GtfsFileHandler<? extends GtfsObject> handler)
Register handlerGtfsFileScheme
getFileScheme()
The file scheme of this reader indicating what file it is operating onGtfsFileReaderSettings
getSettings()
The settings of this GTFS file readerprotected void
initialiseColumnConfiguration(GtfsColumnType columnType)
Let concrete implementation determine the initially excluded columns (if any) based on the provided column type configuration passed in.void
read(Charset charSetToUse)
Perform the reading of the filevoid
reset()
Reset this reader and its registered handlersvoid
setPresenceCondition(GtfsFileConditions filePresenceCondition)
Explicitly indicate the expectations regarding the presence of this file.
-
-
-
Constructor Detail
-
GtfsFileReaderBase
protected GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation)
Constructor using default gtfs reader settings- Parameters:
fileScheme
- the file scheme this file reader is based ongtfsLocation
- to base file location to parse from on (dir or zip file)
-
GtfsFileReaderBase
protected GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation, GtfsFileConditions filePresenceCondition)
Constructor using default gtfs reader settings- Parameters:
fileScheme
- the file scheme this file reader is based ongtfsLocation
- to base file location to parse from on (dir or zip file)filePresenceCondition
- to enforce
-
GtfsFileReaderBase
protected GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation, GtfsFileReaderSettings settings)
Constructor which enforces the file to be present- Parameters:
fileScheme
- the file scheme this file reader is based ongtfsLocation
- to base file location to parse from on (dir or zip file)settings
- to use
-
GtfsFileReaderBase
protected GtfsFileReaderBase(GtfsFileScheme fileScheme, URL gtfsLocation, GtfsFileConditions filePresenceCondition, GtfsFileReaderSettings settings)
Constructor- Parameters:
fileScheme
- the file scheme this file reader is based ongtfsLocation
- to base file location to parse from on (dir or zip file)filePresenceCondition
- to apply (optional, required, conditionally required etc.)settings
- to use
-
-
Method Detail
-
setPresenceCondition
public void setPresenceCondition(GtfsFileConditions filePresenceCondition)
Explicitly indicate the expectations regarding the presence of this file. When marked as optional no warnings will be logged when it is not present.- Parameters:
filePresenceCondition
- to use
-
initialiseColumnConfiguration
protected void initialiseColumnConfiguration(GtfsColumnType columnType)
Let concrete implementation determine the initially excluded columns (if any) based on the provided column type configuration passed in. Note that we log a severe when the chosen column type is not matched, i.e., concrete classes should only call this implementation once they have exhausted their specific column type configurations and not call this beforehand.- Parameters:
columnType
- configuration to apply for initial column exclusions (if any)
-
read
public void read(Charset charSetToUse)
Perform the reading of the file- Parameters:
charSetToUse
- the charset to use
-
addHandler
public void addHandler(GtfsFileHandler<? extends GtfsObject> handler)
Register handler- Parameters:
handler
- to register
-
getFileScheme
public GtfsFileScheme getFileScheme()
The file scheme of this reader indicating what file it is operating on- Returns:
- file scheme
-
getSettings
public GtfsFileReaderSettings getSettings()
The settings of this GTFS file reader- Returns:
- settings
-
reset
public void reset()
Reset this reader and its registered handlers
-
-