Here are my imports:
import com.codename1.ui.*;
import com.codename1.ui.util.*;
import com.codename1.ui.plaf.*;
import com.codename1.ui.events.*;
import com.codename1.io.*;
import com.codename1.ui.layouts.*;
import java.io.*;
I cannot get this code to compile:
InputStream in = new FileInputStream("users.csv");
Here is the error:
C:\Users\Isaac\Documents\NetBeansProjects\CodenameOne_TESTING\src\com\fakecompany\testapp\MyApplication.java:119: error: cannot find symbol
InputStream in = new FileInputStream("users.csv");
symbol: class FileInputStream
location: class MyApplication
I thought this might be a problem with the imports, and sure enough, when I specifically imported java.io.FileImputStream
it gave me an additional error:
C:\Users\Isaac\Documents\NetBeansProjects\CodenameOne_TESTING\src\com\fakecompany\testapp\MyApplication.java:13: error: cannot find symbol
import java.io.FileInputStream;
symbol: class FileInputStream
location: package java.io
What is going on? Is there a different way I am supposed to import files in Codename One? Let me know if this is not enough of my code to find the error.
PS: I need to get an input stream implemented so I can parse the csv file:
CSVParser parser = new CSVParser();
String[][] data = parser.parse(in);
It looks like Codename One has omitted that class - and others, I suspect.
Judging by the documentation, I suspect you want to use the com.codename1.io.FileSystemStorage
class and its openInputStream
method.
You may well want to watch the video on storing data to persistent storage too.
See more on this question at Stackoverflow