Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.util.Log;

import java.io.FileOutputStream;
import java.io.IOException;

public class Main {
    /**
     * Takes in the file stream to the offline file storage that is going to be written to and
     * the latest trip data that is going to be written to the offline storage file.
     * <p/>
     * The new trip data will then be appended to the rest of the trip data.
     *
     * @param writer The output stream of the offline file for storage. Get this from {@link android.content.Context#openFileOutput}
     * @param line   The new trip data as a String
     */
    public synchronized static void writeToOfflineStorage(FileOutputStream writer, String line) {
        try {
            line += "\n";
            writer.write(line.getBytes());
        } catch (IOException e) {
            //TODO: Handle IO exception
            Log.d("ERROR", "IO Exception in OfflineUtilities#writeToOfflineStorage: " + e.getMessage());
        }
    }
}