com.sony.csl.j2me.locationapitools.tracking
Class CSVTrackWriter

java.lang.Object
  extended by com.sony.csl.j2me.locationapitools.tracking.TrackWriter
      extended by com.sony.csl.j2me.locationapitools.tracking.CSVTrackWriter
All Implemented Interfaces:
LocationProxyListener

public class CSVTrackWriter
extends TrackWriter

A TrackWriter subclass that stores a location track as a CSV file.

Author:
mstevens (Sony CSL Paris / Vrije Universiteit Brussel)

Field Summary
static char DEFAULT_CSV_SEPARATOR
           
private  char separator
           
 
Fields inherited from class com.sony.csl.j2me.locationapitools.tracking.TrackWriter
characterEncoding, coveredDistance, firstLocation, firstLocationReceivalTime, firstValidLocation, lastLocation, lastLocationReceivalTime, lastValidLocation, locationProxy, maxAltitude, maxLatitude, maxLongitude, minAltitude, minLatitude, minLongitude, numberOfLocations, numberOfValidLocations, trackFileFolderPath, trackFilePath, trackName, tracksInvalids, trackStartTime
 
Constructor Summary
CSVTrackWriter(LocationProxy locationProxy, java.lang.String trackFileFolderPath, java.lang.String trackName)
           
CSVTrackWriter(LocationProxy locationProxy, java.lang.String trackFileFolderPath, java.lang.String trackName, boolean tracksInvalids)
           
CSVTrackWriter(LocationProxy locationProxy, java.lang.String trackFileFolderPath, java.lang.String trackName, boolean tracksInvalid, char csvSeparator)
           
 
Method Summary
protected  java.lang.String getFileExtension()
          Gets the file extension (e.g.: "txt") that is used on the files the TrackWriter creates
 char getSeparator()
           
protected  void initializeBeforeStart()
          Allows subclasses to add initializations that should take place before tracking starts.
 void setSeparator(char separator)
           
protected  void writeFooter()
          Writes the footer of the file.
protected  void writeHeader()
          Writes the header of the file.
protected  void writeLocation(Location location)
          Writes a new location to the file.
protected  void writePaused(java.lang.String reason)
           
protected  void writeProviderStateChanged(LocationProvider provider, int newState)
           
protected  void writeResumed()
           
 
Methods inherited from class com.sony.csl.j2me.locationapitools.tracking.TrackWriter
firstLocationFound, getCharacterEncoding, getCoveredDistance, getFirstLocation, getFirstLocationReceivalTime, getFirstValidLocation, getLastLocation, getLastLocationReceivalTime, getLastValidLocation, getLocationProxy, getMaxAltitude, getMaxLatitude, getMaxLongitude, getMinAltitude, getMinLatitude, getMinLongitude, getNumberOfLocations, getNumberOfValidLocations, getTrackFilePath, getTrackName, isPaused, isTracking, isTracksInvalids, locationProviderStateChanged, locationUpdated, pauseTracking, pauseTracking, proxyConnected, proxyDisconnected, receivesInvalidLocations, reset, resumeTracking, setCharacterEncoding, startTracking, stopTracking, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CSV_SEPARATOR

public static final char DEFAULT_CSV_SEPARATOR
See Also:
Constant Field Values

separator

private char separator
Constructor Detail

CSVTrackWriter

public CSVTrackWriter(LocationProxy locationProxy,
                      java.lang.String trackFileFolderPath,
                      java.lang.String trackName)
               throws java.lang.Exception
Throws:
java.lang.Exception

CSVTrackWriter

public CSVTrackWriter(LocationProxy locationProxy,
                      java.lang.String trackFileFolderPath,
                      java.lang.String trackName,
                      boolean tracksInvalids)
               throws java.lang.Exception
Throws:
java.lang.Exception

CSVTrackWriter

public CSVTrackWriter(LocationProxy locationProxy,
                      java.lang.String trackFileFolderPath,
                      java.lang.String trackName,
                      boolean tracksInvalid,
                      char csvSeparator)
               throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getSeparator

public char getSeparator()
Returns:
the separator

setSeparator

public void setSeparator(char separator)
                  throws java.lang.Exception
Parameters:
separator - the separator to set
Throws:
java.lang.Exception

getFileExtension

protected java.lang.String getFileExtension()
Description copied from class: TrackWriter
Gets the file extension (e.g.: "txt") that is used on the files the TrackWriter creates

Specified by:
getFileExtension in class TrackWriter
Returns:
a String containing the file extension (without the '.')
See Also:
TrackWriter.getFileExtension()

writeHeader

protected void writeHeader()
Description copied from class: TrackWriter
Writes the header of the file.

Specified by:
writeHeader in class TrackWriter
See Also:
TrackWriter.writeHeader()

writeLocation

protected void writeLocation(Location location)
Description copied from class: TrackWriter
Writes a new location to the file.

Specified by:
writeLocation in class TrackWriter
See Also:
TrackWriter.writeLocation(javax.microedition.location.Location)

writePaused

protected void writePaused(java.lang.String reason)
Specified by:
writePaused in class TrackWriter
See Also:
TrackWriter.writePaused(java.lang.String)

writeResumed

protected void writeResumed()
Specified by:
writeResumed in class TrackWriter
See Also:
TrackWriter.writeResumed()

writeProviderStateChanged

protected void writeProviderStateChanged(LocationProvider provider,
                                         int newState)
Specified by:
writeProviderStateChanged in class TrackWriter
See Also:
TrackWriter.writeProviderStateChanged(javax.microedition.location.LocationProvider, int)

writeFooter

protected void writeFooter()
Description copied from class: TrackWriter
Writes the footer of the file.

Specified by:
writeFooter in class TrackWriter
See Also:
TrackWriter.writeFooter()

initializeBeforeStart

protected void initializeBeforeStart()
Description copied from class: TrackWriter
Allows subclasses to add initializations that should take place before tracking starts.

Specified by:
initializeBeforeStart in class TrackWriter
See Also:
TrackWriter.initializeBeforeStart()