|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.SwingWorker<java.lang.Void,java.lang.String>
com.billpringle.utils.WrpBuildZipCodes.ConvertWorker
private class WrpBuildZipCodes.ConvertWorker
This class converts the USPS input text file to a CSV text file in the background. Some methods in this class run in the background and converts the USPS input City/State National input file to a CSV file that can be imported into a database.
This class uses the ZipFileReader class to read the input file, builds a list of the cities for a given zip code, and then writes the results to a CSV text file. The fields of the output CSV file are:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.SwingWorker |
---|
javax.swing.SwingWorker.StateValue |
Constructor Summary | |
---|---|
WrpBuildZipCodes.ConvertWorker()
Default (and only) constructor. |
Method Summary | |
---|---|
protected void |
addCities(WrpZipCode czip,
WrpZipCode zip)
Add the cities in the zipcode zip to the current zipcode czip. |
void |
convertZipCodes()
Convert input file to output CSV file. |
protected java.lang.Void |
doInBackground()
This is the main background method to convert records. |
protected void |
process(java.util.List<java.lang.String> str)
Foreground method to process the most recent entries that were converted. |
protected void |
writeZipCode(WrpZipCode zip,
java.io.PrintStream prt)
Write CSV lines to the output file for this zip code. |
Methods inherited from class javax.swing.SwingWorker |
---|
addPropertyChangeListener, cancel, done, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, publish, removePropertyChangeListener, run, setProgress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WrpBuildZipCodes.ConvertWorker()
Method Detail |
---|
protected java.lang.Void doInBackground()
doInBackground
in class javax.swing.SwingWorker<java.lang.Void,java.lang.String>
protected void process(java.util.List<java.lang.String> str)
This list passed as an argument is a collection of the strings that were passed from the publish() background method. Rather than list all zip codes that have been processed, this method simply displays the most recent zip code entry in the scrolled log list.
process
in class javax.swing.SwingWorker<java.lang.Void,java.lang.String>
public void convertZipCodes()
protected void addCities(WrpZipCode czip, WrpZipCode zip)
czip
- the current zipcodezip
- the zipcode to add to the current zipcodeprotected void writeZipCode(WrpZipCode zip, java.io.PrintStream prt)
zip
- the zip code objectprt
- the output CSV file
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |