Hallo
bekomme jedesmal wenn ich einen Vektor speichern will eine not Serializable Exception
und die Klasse WakeTime: (ist Serializable , genauso wie LocalTime und LocalDateTime aus der joda time bibliothek
Wo liegt hier der Fehler?
danke im Vorraus
mfg
bekomme jedesmal wenn ich einen Vektor speichern will eine not Serializable Exception
Code:
private Vector<WakeTime> v = new Vector<WakeTime>();
private void add(WakeTime wakeTime) {
v.add(wakeTime);
try {
FileOutputStream fos = new FileOutputStream(wakeTimeFile);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(v);
oos.flush();
oos.close();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
und die Klasse WakeTime: (ist Serializable , genauso wie LocalTime und LocalDateTime aus der joda time bibliothek
Code:
private class WakeTime implements Serializable {
private static final long serialVersionUID = -5466187340776272100L;
private String type = null;
private LocalDateTime dTime = null;
private LocalTime time = null;
public String getType() {
return type;
}
public LocalDateTime getDTime() {
return dTime;
}
public LocalTime getTime() {
return time;
}
WakeTime(String type, LocalDateTime dtime) {
this.type = type;
this.dTime = dtime;
}
WakeTime(String type, LocalTime time) {
this.type = type;
this.time = time;
}
}
Wo liegt hier der Fehler?
danke im Vorraus
mfg