From 0955e9f0898faf0005d3e0f78b65e209e8b3fa34 Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Tue, 27 Aug 2013 18:09:34 -0700 Subject: [PATCH] Rename TrackFormatWriter to TrackWriter --- .../apps/mytracks/io/file/CsvTrackWriter.java | 2 +- .../apps/mytracks/io/file/GpxTrackWriter.java | 2 +- .../apps/mytracks/io/file/KmlTrackWriter.java | 2 +- .../apps/mytracks/io/file/TcxTrackWriter.java | 2 +- .../apps/mytracks/io/file/TrackExporter.java | 40 +++++------ .../mytracks/io/file/TrackFileFormat.java | 12 ++-- ...rackFormatWriter.java => TrackWriter.java} | 2 +- .../mytracks/io/file/CsvTrackWriterTest.java | 6 +- .../mytracks/io/file/GpxTrackWriterTest.java | 6 +- .../mytracks/io/file/KmlTrackWriterTest.java | 6 +- .../mytracks/io/file/TcxTrackWriterTest.java | 6 +- .../mytracks/io/file/TrackExporterTest.java | 68 +++++++++---------- ...atWriterTest.java => TrackWriterTest.java} | 42 ++++++------ 13 files changed, 98 insertions(+), 98 deletions(-) rename MyTracks/src/com/google/android/apps/mytracks/io/file/{TrackFormatWriter.java => TrackWriter.java} (98%) rename MyTracksTest/src/com/google/android/apps/mytracks/io/file/{TrackFormatWriterTest.java => TrackWriterTest.java} (89%) diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/CsvTrackWriter.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/CsvTrackWriter.java index 7a95a7aaa..d0f2e170c 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/CsvTrackWriter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/CsvTrackWriter.java @@ -48,7 +48,7 @@ import java.text.NumberFormat; * * @author Rodrigo Damazio */ -public class CsvTrackWriter implements TrackFormatWriter { +public class CsvTrackWriter implements TrackWriter { private static final NumberFormat SHORT_FORMAT = NumberFormat.getInstance(); diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/GpxTrackWriter.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/GpxTrackWriter.java index 75d45dad5..8e1a96806 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/GpxTrackWriter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/GpxTrackWriter.java @@ -34,7 +34,7 @@ import java.util.Locale; * * @author Sandor Dornbush */ -public class GpxTrackWriter implements TrackFormatWriter { +public class GpxTrackWriter implements TrackWriter { private static final NumberFormat ELEVATION_FORMAT = NumberFormat.getInstance(Locale.US); private static final NumberFormat COORDINATE_FORMAT = NumberFormat.getInstance(Locale.US); diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/KmlTrackWriter.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/KmlTrackWriter.java index 0fc315a96..a070b8cc7 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/KmlTrackWriter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/KmlTrackWriter.java @@ -44,7 +44,7 @@ import java.util.ArrayList; * * @author Leif Hendrik Wilden */ -public class KmlTrackWriter implements TrackFormatWriter { +public class KmlTrackWriter implements TrackWriter { private static final String WAYPOINT_STYLE = "waypoint"; private static final String STATISTICS_STYLE = "statistics"; diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/TcxTrackWriter.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/TcxTrackWriter.java index 827b2a3b1..bb5fa7a50 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/TcxTrackWriter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/TcxTrackWriter.java @@ -40,7 +40,7 @@ import java.util.Locale; * @author Sandor Dornbush * @author Dominik Ršttsches */ -public class TcxTrackWriter implements TrackFormatWriter { +public class TcxTrackWriter implements TrackWriter { /** * TCX sport type. See the TCX spec. diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackExporter.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackExporter.java index c7ec7849b..bba289419 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackExporter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackExporter.java @@ -59,7 +59,7 @@ public class TrackExporter { private final MyTracksProviderUtils myTracksProviderUtils; private final Track[] tracks; - private final TrackFormatWriter trackFormatWriter; + private final TrackWriter trackWriter; private final OnWriteListener onWriteListener; private Thread writeThread; @@ -76,15 +76,15 @@ public class TrackExporter { */ public TrackExporter(Context context, MyTracksProviderUtils myTracksProviderUtils, Track[] tracks, TrackFileFormat trackFileFormat, OnWriteListener onWriteListener) { - this(myTracksProviderUtils, tracks, trackFileFormat.newFormatWriter(context), onWriteListener); + this(myTracksProviderUtils, tracks, trackFileFormat.newTrackWriter(context), onWriteListener); } @VisibleForTesting public TrackExporter(MyTracksProviderUtils myTracksProviderUtils, Track[] tracks, - TrackFormatWriter trackFormatWriter, OnWriteListener onWriteListener) { + TrackWriter trackWriter, OnWriteListener onWriteListener) { this.myTracksProviderUtils = myTracksProviderUtils; this.tracks = tracks; - this.trackFormatWriter = trackFormatWriter; + this.trackWriter = trackWriter; this.onWriteListener = onWriteListener; } @@ -105,16 +105,16 @@ public class TrackExporter { @Override public void run() { try { - trackFormatWriter.prepare(outputStream); - trackFormatWriter.writeHeader(tracks[0]); + trackWriter.prepare(outputStream); + trackWriter.writeHeader(tracks[0]); long startTime = tracks[0].getTripStatistics().getStartTime(); for (int i = 0; i < tracks.length; i++) { writeWaypoints(tracks[i]); long offset = tracks[i].getTripStatistics().getStartTime() - startTime; writeLocations(tracks[i], offset); } - trackFormatWriter.writeFooter(); - trackFormatWriter.close(); + trackWriter.writeFooter(); + trackWriter.close(); success = true; } catch (InterruptedException e) { success = false; @@ -169,11 +169,11 @@ public class TrackExporter { */ while (cursor.moveToNext()) { if (!hasWaypoints) { - trackFormatWriter.writeBeginWaypoints(); + trackWriter.writeBeginWaypoints(); hasWaypoints = true; } Waypoint waypoint = myTracksProviderUtils.createWaypoint(cursor); - trackFormatWriter.writeWaypoint(waypoint); + trackWriter.writeWaypoint(waypoint); } } } finally { @@ -182,7 +182,7 @@ public class TrackExporter { } } if (hasWaypoints) { - trackFormatWriter.writeEndWaypoints(); + trackWriter.writeEndWaypoints(); } } @@ -211,28 +211,28 @@ public class TrackExporter { boolean isSegmentValid = isLocationValid && isLastLocationValid; if (!wroteTrack && isSegmentValid) { // Found the first two consecutive locations that are valid - trackFormatWriter.writeBeginTrack(track, locationFactory.lastLocation); + trackWriter.writeBeginTrack(track, locationFactory.lastLocation); wroteTrack = true; } if (isSegmentValid) { if (!wroteSegment) { // Start a segment - trackFormatWriter.writeOpenSegment(); + trackWriter.writeOpenSegment(); wroteSegment = true; // Write the previous location, which we had previously skipped - trackFormatWriter.writeLocation(locationFactory.lastLocation); + trackWriter.writeLocation(locationFactory.lastLocation); } // Write the current location - trackFormatWriter.writeLocation(location); + trackWriter.writeLocation(location); if (onWriteListener != null) { onWriteListener.onWrite(locationNumber, track.getNumberOfPoints()); } } else { if (wroteSegment) { - trackFormatWriter.writeCloseSegment(); + trackWriter.writeCloseSegment(); wroteSegment = false; } } @@ -241,17 +241,17 @@ public class TrackExporter { } if (wroteSegment) { - trackFormatWriter.writeCloseSegment(); + trackWriter.writeCloseSegment(); wroteSegment = false; } if (wroteTrack) { Location lastValidTrackPoint = myTracksProviderUtils.getLastValidTrackPoint(track.getId()); setLocationTime(lastValidTrackPoint, offset); - trackFormatWriter.writeEndTrack(track, lastValidTrackPoint); + trackWriter.writeEndTrack(track, lastValidTrackPoint); } else { // Write an empty track - trackFormatWriter.writeBeginTrack(track, null); - trackFormatWriter.writeEndTrack(track, null); + trackWriter.writeBeginTrack(track, null); + trackWriter.writeEndTrack(track, null); } } finally { iterator.close(); diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackFileFormat.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackFileFormat.java index b4362ee80..b5e6db5f1 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackFileFormat.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackFileFormat.java @@ -12,25 +12,25 @@ import java.util.Locale; public enum TrackFileFormat implements Parcelable { KML { @Override - TrackFormatWriter newFormatWriter(Context context) { + TrackWriter newTrackWriter(Context context) { return new KmlTrackWriter(context); } }, GPX { @Override - TrackFormatWriter newFormatWriter(Context context) { + TrackWriter newTrackWriter(Context context) { return new GpxTrackWriter(context); } }, CSV { @Override - public TrackFormatWriter newFormatWriter(Context context) { + public TrackWriter newTrackWriter(Context context) { return new CsvTrackWriter(context); } }, TCX { @Override - public TrackFormatWriter newFormatWriter(Context context) { + public TrackWriter newTrackWriter(Context context) { return new TcxTrackWriter(context); } }; @@ -58,9 +58,9 @@ public enum TrackFileFormat implements Parcelable { }; /** - * Creates and returns a new format writer for each format. + * Creates a new track writer for the format. */ - abstract TrackFormatWriter newFormatWriter(Context context); + abstract TrackWriter newTrackWriter(Context context); /** * Returns the mime type for each format. diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackFormatWriter.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackWriter.java similarity index 98% rename from MyTracks/src/com/google/android/apps/mytracks/io/file/TrackFormatWriter.java rename to MyTracks/src/com/google/android/apps/mytracks/io/file/TrackWriter.java index 79b61b5f3..e275c62fb 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackFormatWriter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackWriter.java @@ -50,7 +50,7 @@ import java.io.OutputStream; * * @author Rodrigo Damazio */ -public interface TrackFormatWriter { +public interface TrackWriter { /** * Gets the file extension (i.e. gpx, kml, ...) diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/CsvTrackWriterTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/CsvTrackWriterTest.java index 921839420..71da28700 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/CsvTrackWriterTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/CsvTrackWriterTest.java @@ -21,7 +21,7 @@ package com.google.android.apps.mytracks.io.file; * * @author Rodrigo Damazio */ -public class CsvTrackWriterTest extends TrackFormatWriterTest { +public class CsvTrackWriterTest extends TrackWriterTest { private static final String BEGIN_TAG = "\""; private static final String END_TAG = "\"\n"; @@ -62,8 +62,8 @@ public class CsvTrackWriterTest extends TrackFormatWriterTest { + expectedMarkerHeader + expectedMarker1 + expectedMarker2 + "\n" + expectedPointHeader + expectedPoint1 + expectedPoint2 + expectedPoint3 + expectedPoint4; - CsvTrackWriter writer = new CsvTrackWriter(getContext()); - assertEquals(expected, writeTrack(writer)); + CsvTrackWriter csvTrackWriter = new CsvTrackWriter(getContext()); + assertEquals(expected, writeTrack(csvTrackWriter)); } /** diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/GpxTrackWriterTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/GpxTrackWriterTest.java index 7bb053b88..90cff9bef 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/GpxTrackWriterTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/GpxTrackWriterTest.java @@ -25,11 +25,11 @@ import org.w3c.dom.Element; * * @author Rodrigo Damazio */ -public class GpxTrackWriterTest extends TrackFormatWriterTest { +public class GpxTrackWriterTest extends TrackWriterTest { public void testXmlOutput() throws Exception { - TrackFormatWriter writer = new GpxTrackWriter(getContext()); - String result = writeTrack(writer); + GpxTrackWriter gpxTrackWriter = new GpxTrackWriter(getContext()); + String result = writeTrack(gpxTrackWriter); Document doc = parseXmlDocument(result); Element gpxTag = getChildElement(doc, "gpx"); diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/KmlTrackWriterTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/KmlTrackWriterTest.java index 9e38d0480..21a42b9aa 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/KmlTrackWriterTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/KmlTrackWriterTest.java @@ -32,7 +32,7 @@ import org.w3c.dom.Element; * * @author Rodrigo Damazio */ -public class KmlTrackWriterTest extends TrackFormatWriterTest { +public class KmlTrackWriterTest extends TrackWriterTest { private static final String FULL_TRACK_DESCRIPTION = "full track description"; @@ -54,8 +54,8 @@ public class KmlTrackWriterTest extends TrackFormatWriterTest { } public void testXmlOutput() throws Exception { - KmlTrackWriter writer = new KmlTrackWriter(getContext(), new FakeDescriptionGenerator()); - String result = writeTrack(writer); + KmlTrackWriter kmlTrackWriter = new KmlTrackWriter(getContext(), new FakeDescriptionGenerator()); + String result = writeTrack(kmlTrackWriter); Document doc = parseXmlDocument(result); Element kmlTag = getChildElement(doc, "kml"); diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TcxTrackWriterTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TcxTrackWriterTest.java index 547229a4e..6b68de7e9 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TcxTrackWriterTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TcxTrackWriterTest.java @@ -29,11 +29,11 @@ import org.w3c.dom.Element; * * @author Sandor Dornbush */ -public class TcxTrackWriterTest extends TrackFormatWriterTest { +public class TcxTrackWriterTest extends TrackWriterTest { public void testXmlOutput() throws Exception { - TrackFormatWriter writer = new TcxTrackWriter(getContext()); - String result = writeTrack(writer); + TcxTrackWriter tcxTrackWriter = new TcxTrackWriter(getContext()); + String result = writeTrack(tcxTrackWriter); Document doc = parseXmlDocument(result); Element root = getChildElement(doc, "TrainingCenterDatabase"); diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackExporterTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackExporterTest.java index c5c802291..2aeee01e1 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackExporterTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackExporterTest.java @@ -39,7 +39,7 @@ public class TrackExporterTest extends AndroidTestCase { private IMocksControl mocksControl; - private TrackFormatWriter trackFormatWriter; + private TrackWriter trackWriter; private Track track; private OutputStream outputStream; private TrackExporter trackExporter; @@ -61,7 +61,7 @@ public class TrackExporterTest extends AndroidTestCase { myTracksProviderUtils); mocksControl = EasyMock.createStrictControl(); - trackFormatWriter = mocksControl.createMock(TrackFormatWriter.class); + trackWriter = mocksControl.createMock(TrackWriter.class); track = new Track(); track.setName(TRACK_NAME); @@ -76,7 +76,7 @@ public class TrackExporterTest extends AndroidTestCase { } }; - trackExporter = new TrackExporter(myTracksProviderUtils, new Track[] {track}, trackFormatWriter, onWriteListener); + trackExporter = new TrackExporter(myTracksProviderUtils, new Track[] {track}, trackWriter, onWriteListener); } @Override @@ -91,12 +91,12 @@ public class TrackExporterTest extends AndroidTestCase { public void testWriteTrack_emptyTrack() throws Exception { // Set expected mock behavior - trackFormatWriter.prepare(outputStream); - trackFormatWriter.writeHeader(track); - trackFormatWriter.writeBeginTrack(track, null); - trackFormatWriter.writeEndTrack(track, null); - trackFormatWriter.writeFooter(); - trackFormatWriter.close(); + trackWriter.prepare(outputStream); + trackWriter.writeHeader(track); + trackWriter.writeBeginTrack(track, null); + trackWriter.writeEndTrack(track, null); + trackWriter.writeFooter(); + trackWriter.close(); mocksControl.replay(); trackExporter.writeTrack(outputStream); @@ -123,12 +123,12 @@ public class TrackExporterTest extends AndroidTestCase { myTracksProviderUtils.bulkInsertTrackPoint(locations, locations.length, TRACK_ID)); // Set expected mock behavior - trackFormatWriter.prepare(outputStream); - trackFormatWriter.writeHeader(track); - trackFormatWriter.writeBeginTrack(track, null); - trackFormatWriter.writeEndTrack(track, null); - trackFormatWriter.writeFooter(); - trackFormatWriter.close(); + trackWriter.prepare(outputStream); + trackWriter.writeHeader(track); + trackWriter.writeBeginTrack(track, null); + trackWriter.writeEndTrack(track, null); + trackWriter.writeFooter(); + trackWriter.close(); mocksControl.replay(); trackExporter.writeTrack(outputStream); @@ -162,38 +162,38 @@ public class TrackExporterTest extends AndroidTestCase { waypoint.setId(i + 1); } - trackFormatWriter.prepare(outputStream); - trackFormatWriter.writeHeader(track); + trackWriter.prepare(outputStream); + trackWriter.writeHeader(track); // Expect reading/writing of the waypoints (except the first) - trackFormatWriter.writeBeginWaypoints(); - trackFormatWriter.writeWaypoint(waypointEq(waypoints[1])); - trackFormatWriter.writeWaypoint(waypointEq(waypoints[2])); - trackFormatWriter.writeEndWaypoints(); + trackWriter.writeBeginWaypoints(); + trackWriter.writeWaypoint(waypointEq(waypoints[1])); + trackWriter.writeWaypoint(waypointEq(waypoints[2])); + trackWriter.writeEndWaypoints(); // Begin the track - trackFormatWriter.writeBeginTrack(trackEq(track), locationEq(locations[0])); + trackWriter.writeBeginTrack(trackEq(track), locationEq(locations[0])); // Write locations 1-2 - trackFormatWriter.writeOpenSegment(); - trackFormatWriter.writeLocation(locationEq(locations[0])); - trackFormatWriter.writeLocation(locationEq(locations[1])); - trackFormatWriter.writeCloseSegment(); + trackWriter.writeOpenSegment(); + trackWriter.writeLocation(locationEq(locations[0])); + trackWriter.writeLocation(locationEq(locations[1])); + trackWriter.writeCloseSegment(); // Location 3 is not written - it's invalid // Write locations 4-6 - trackFormatWriter.writeOpenSegment(); - trackFormatWriter.writeLocation(locationEq(locations[3])); - trackFormatWriter.writeLocation(locationEq(locations[4])); - trackFormatWriter.writeLocation(locationEq(locations[5])); - trackFormatWriter.writeCloseSegment(); + trackWriter.writeOpenSegment(); + trackWriter.writeLocation(locationEq(locations[3])); + trackWriter.writeLocation(locationEq(locations[4])); + trackWriter.writeLocation(locationEq(locations[5])); + trackWriter.writeCloseSegment(); // End the track - trackFormatWriter.writeEndTrack(trackEq(track), locationEq(locations[5])); + trackWriter.writeEndTrack(trackEq(track), locationEq(locations[5])); - trackFormatWriter.writeFooter(); - trackFormatWriter.close(); + trackWriter.writeFooter(); + trackWriter.close(); mocksControl.replay(); trackExporter.writeTrack(outputStream); diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackFormatWriterTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackWriterTest.java similarity index 89% rename from MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackFormatWriterTest.java rename to MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackWriterTest.java index 41c7e6a92..73bc6e1e9 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackFormatWriterTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/file/TrackWriterTest.java @@ -34,7 +34,7 @@ import org.xml.sax.SAXException; * * @author Rodrigo Damazio */ -public abstract class TrackFormatWriterTest extends AndroidTestCase { +public abstract class TrackWriterTest extends AndroidTestCase { // All the user-provided strings have "]]>" to ensure that proper escaping is // being done. @@ -110,29 +110,29 @@ public abstract class TrackFormatWriterTest extends AndroidTestCase { * Makes the right sequence of calls to the writer in order to write the fake * track in {@link #track}. * - * @param writer the writer to write to + * @param trackWriter the track writer * @return the written contents */ - protected String writeTrack(TrackFormatWriter writer) throws Exception { + protected String writeTrack(TrackWriter trackWriter) throws Exception { OutputStream output = new ByteArrayOutputStream(BUFFER_SIZE); - writer.prepare(output); - writer.writeHeader(track); - writer.writeBeginWaypoints(); - writer.writeWaypoint(wp1); - writer.writeWaypoint(wp2); - writer.writeEndWaypoints(); - writer.writeBeginTrack(track, location1); - writer.writeOpenSegment(); - writer.writeLocation(location1); - writer.writeLocation(location2); - writer.writeCloseSegment(); - writer.writeOpenSegment(); - writer.writeLocation(location3); - writer.writeLocation(location4); - writer.writeCloseSegment(); - writer.writeEndTrack(track, location4); - writer.writeFooter(); - writer.close(); + trackWriter.prepare(output); + trackWriter.writeHeader(track); + trackWriter.writeBeginWaypoints(); + trackWriter.writeWaypoint(wp1); + trackWriter.writeWaypoint(wp2); + trackWriter.writeEndWaypoints(); + trackWriter.writeBeginTrack(track, location1); + trackWriter.writeOpenSegment(); + trackWriter.writeLocation(location1); + trackWriter.writeLocation(location2); + trackWriter.writeCloseSegment(); + trackWriter.writeOpenSegment(); + trackWriter.writeLocation(location3); + trackWriter.writeLocation(location4); + trackWriter.writeCloseSegment(); + trackWriter.writeEndTrack(track, location4); + trackWriter.writeFooter(); + trackWriter.close(); return output.toString(); }