たとえばMyStaticClass
、静的クラスがあるとします。これには、たとえば次のように、ファイルとの間で自身を保存およびロードするための2つのメソッドがあります。
private static void save() throws IOException {
FileOutputStream fos = new FileOutputStream(new File("myfile.dat"));
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(???);
oos.close();
}
private static void load() throws IOException {
FileInputStream fis = new FileInputStream(new File("myfile.dat"));
ObjectInputStream ois = new ObjectInputStream(fis);
??? = (MyStaticClass) ois.readObject();
ois.close();
}
???
通常オブジェクトのインスタンスを配置する場所の代わりに何を配置する必要がありますか?
インスタンスに使用されているものとは異なる静的クラスをファイルに保存する方法はありますか?