这是我可序列化的课程。
public class Person implements Serializable{
private String name;
private String surname;
private int age;
public Person(String name,String surname,int age){
this.name = name;
this.surname = surname;
this.age = age;
}
public void setSurname(String surname) {
this.surname = surname;
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age){
this.age = age;
}
public int getAge() {
return age;
}
public String getName() {
return name;
}
public String getSurname() {
return surname;
}
public String toString(){
return name + " "+surname+" "+age;
}
}
我正在尝试使用FileOutputStream将Person类写入原始文件夹,但没有任何工作。无法创建FileOutputStream以获取原始文件夹文件。
我也尝试过FileOutputStream。
FileOutputStream fos = getBaseContext().openFileOutput(
"android.resource://com.cpt.sample/raw/text.txt",MODE_PRIVATE);