1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
public static void SET_OBJECT_SERIALISATION(String valeurstring, JComponent valeurobject){
try{
OutputStream file = new FileOutputStream(valeurstring);
OutputStream buffer = new BufferedOutputStream(file);
ObjectOutput output = new ObjectOutputStream(buffer);
try{
output.writeObject(valeurobject);
}finally{
output.close();
}
}catch(IOException monerreur){
ExceptionsPerso.showError(new Exception(monerreur));
}
}
public static JComponent GET_OBJECT_SERIALISATION(String valeurstring){
JComponent lavaleur = new JPanel();
try{
InputStream file = new FileInputStream(valeurstring);
InputStream buffer = new BufferedInputStream(file);
ObjectInput input = new ObjectInputStream (buffer);
try{
lavaleur = (JComponent) input.readObject();
} catch (ClassNotFoundException monerreur) {
ExceptionsPerso.showError(new Exception(monerreur));
}finally{
input.close();
}
}catch(IOException monerreur){
ExceptionsPerso.showError(new Exception(monerreur));
}
return lavaleur;
} |
Partager