请教各位j2me中读写文件的问题
try{
InputStream inputStream = this.getClass().getResourceAsStream( "iconname.txt ");
stringBuffer = new StringBuffer();
int input;
while ((input = inputStream.read()) != -1){
if (input != '\n '){
stringBuffer.append((char)input);
}else{
iconNameVector.addElement(stringBuffer.toString());
stringBuffer = new StringBuffer();
}
}
inputStream.close();
connect.close();
}catch(Exception ex){
System.out.println( "the file connection could not be established ");
}
这种情况下会出现错误
java.lang.NullPointerException try{
connect = (StreamConnection)Connector.open( "http://localhost:8080/iconname.txt ", Connector.READ);
inputStream = connect.openInputStream();
stringBuffer = new StringBuffer();
int input;
while ((input = inputStream.read()) != -1){
if (input != '\n '){