在Codename One中,为什么我不能让FileInputStream导入或编译? [英] In Codename One, why can I not get FileInputStream to import or compile?
问题描述
这是我的进口商品:
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.*;
我无法编译此代码:
InputStream in = new FileInputStream("users.csv");
这是错误:
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
我认为这可能是导入问题,而且确实可以肯定,当我专门导入 java.io.FileImputStream
时,它给了我一个额外的错误:
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
发生了什么上?我应该以其他方式导入Codename One中的文件吗?让我知道这是否还不足以找到错误。
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:我需要实现一个输入流,以便可以解析csv文件:
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);
推荐答案
似乎代号One省略了该类-并且
It looks like Codename One has omitted that class - and others, I suspect.
从文档来看,我怀疑您要使用 com.codename1.io.FileSystemStorage
类及其 openInputStream
方法。
Judging by the documentation, I suspect you want to use the com.codename1.io.FileSystemStorage
class and its openInputStream
method.
您可能希望观看有关将数据存储到持久性存储中的视频。
这篇关于在Codename One中,为什么我不能让FileInputStream导入或编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!