one.empty3.library.core.script.ModeleIO Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of empty3-library-generic Show documentation
Show all versions of empty3-library-generic Show documentation
3D rendering engine. Plus modeling. Expected glsl textures 3d and 2d rendering
/*
* Copyright (c) 2023. Manuel Daniel Dahmen
*
*
* Copyright 2012-2023 Manuel Daniel Dahmen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
Vous êtes libre de :
*/
package one.empty3.library.core.script;
import one.empty3.library.*;
import one.empty3.library.*;
import java.io.*;
public class ModeleIO {
public static boolean sauvergarder(Representable o, File file) {
boolean r = false;
ObjectOutputStream dos = null;
FileOutputStream fos = null;
try {
dos = new ObjectOutputStream(fos = new FileOutputStream(file));
r = true;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
dos.writeObject(o);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
dos.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return r;
}
public static boolean sauvergarder(Scene sc, File file) {
boolean r = false;
ObjectOutputStream dos = null;
FileOutputStream fos = null;
try {
sc.dumpDATA();
fos = new FileOutputStream(file);
dos = new ObjectOutputStream(fos);
r = true;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
dos.writeObject(sc);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
dos.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return r;
}
public static boolean sauvergarderTXT(Scene sc, File file) {
String txt = sc.toString();
boolean r = false;
FileOutputStream dos = null;
BufferedOutputStream pw = null;
try {
dos = new FileOutputStream(file);
pw = new BufferedOutputStream(dos);
pw.write(txt.getBytes(), 0, txt.length());
pw.close();
dos.close();
r = true;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return r;
}
public Scene charger(Scene sc, File file) {
boolean r = false;
ObjectInputStream dos = null;
try {
dos = new ObjectInputStream(new FileInputStream(file));
r = true;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
return (Scene) dos.readObject();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
dos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy