Last active
October 15, 2017 11:13
-
-
Save Butch78/cb4e8785e81574a60cae246a92d32623 to your computer and use it in GitHub Desktop.
TempJava
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package swindroid.suntime.calc; | |
import android.content.res.Resources; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.util.ArrayList; | |
import swindroid.suntime.R; | |
/** | |
* Created by Matthew on 28/09/2017. | |
*/ | |
public class CSVFile { | |
private InputStream auInputStream; | |
private InputStream addedInputStream; | |
private OutputStream outputStream; | |
public CSVFile(InputStream auInputStream, InputStream addedInputStream, OutputStream outputStream) | |
{ | |
this.auInputStream = auInputStream; | |
this.addedInputStream = addedInputStream; | |
this.outputStream = outputStream; | |
} | |
public ArrayList<String[]> readFiles(InputStream inputStream) | |
{ | |
ArrayList<String []> resultList = new ArrayList<String[]>(); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); | |
try | |
{ | |
String csvLine; | |
while ((csvLine = reader.readLine()) != null) { | |
String[] row = csvLine.split(","); | |
resultList.add(row); | |
} | |
} | |
catch(IOException ex) | |
{ | |
throw new RuntimeException("Error in CSV file" +ex); | |
} | |
finally { | |
try{ | |
inputStream.close(); | |
} | |
catch (IOException e) | |
{ | |
throw new RuntimeException("Error while closing stream:"+e); | |
} | |
} | |
return resultList; | |
} | |
public ArrayList<String[]> read() | |
{ | |
ArrayList<String []> temp = readFiles(auInputStream); | |
ArrayList<String []> resultList = new ArrayList<String[]>(); | |
resultList.addAll(temp); | |
temp = readFiles(addedInputStream); | |
resultList.addAll(temp); | |
return resultList; | |
} | |
public void write(GeoLocation geoLocation) | |
{ | |
ArrayList<String []> resultList = new ArrayList<String[]>(); | |
OutputStream writer = | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment