use of java.io.ObjectInputStream in project Synthese_2BIN by TheYoungSensei.
the class ListeTrajets method deserialize.
@SuppressWarnings("unchecked")
public static boolean deserialize(String nomFichier) throws IOException, ClassNotFoundException {
checkString(nomFichier);
Path p = FileSystems.getDefault().getPath(nomFichier);
if (Files.exists(p) && !Files.isReadable(p))
return false;
try (InputStream in = Files.newInputStream(p);
ObjectInputStream o = new ObjectInputStream(in)) {
Assembly.getListeTrajets().trajets = (SortedSet<Trajet>) o.readObject();
}
return true;
}
use of java.io.ObjectInputStream in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class DataTag method load.
private DataTag load() {
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
DataTag obj = (DataTag) in.readObject();
ints = obj.ints;
strings = obj.strings;
booleans = obj.booleans;
bytes = obj.bytes;
floats = obj.floats;
shorts = obj.shorts;
doubles = obj.doubles;
longs = obj.longs;
tags = obj.tags;
objs = obj.objs;
intArrays = obj.intArrays;
stringArrays = obj.stringArrays;
booleanArrays = obj.booleanArrays;
byteArrays = obj.byteArrays;
floatArrays = obj.floatArrays;
shortArrays = obj.shortArrays;
doubleArrays = obj.doubleArrays;
longArrays = obj.longArrays;
objArrays = obj.objArrays;
in.close();
} catch (Exception i) {
if (!i.getClass().equals(EOFException.class)) {
System.err.println("Exception: " + i.getClass().getName());
i.printStackTrace();
}
}
return this;
}
use of java.io.ObjectInputStream in project voltdb by VoltDB.
the class InOutUtil method deserialize.
/**
* Deserializes the specified byte array to an
* <CODE>Object</CODE> instance.
*
* @return the Object resulting from deserializing the specified array of bytes
* @param ba the byte array to deserialize to an Object
*/
public static Serializable deserialize(byte[] ba) throws IOException, ClassNotFoundException {
HsqlByteArrayInputStream bi = new HsqlByteArrayInputStream(ba);
ObjectInputStream is = new ObjectInputStream(bi);
return (Serializable) is.readObject();
}
use of java.io.ObjectInputStream in project android_frameworks_base by ResurrectionRemix.
the class PrintPsTree method main.
public static void main(String[] args) throws IOException, ClassNotFoundException {
if (args.length != 1) {
System.err.println("Usage: PrintCsv [compiled log file]");
System.exit(0);
}
FileInputStream fin = new FileInputStream(args[0]);
ObjectInputStream oin = new ObjectInputStream(new BufferedInputStream(fin));
Root root = (Root) oin.readObject();
for (Proc proc : root.processes.values()) {
if (proc.parent == null) {
proc.print();
}
}
}
use of java.io.ObjectInputStream in project android_frameworks_base by ResurrectionRemix.
the class Root method fromFile.
/**
* Reads Root from a file.
*/
static Root fromFile(String fileName) throws IOException, ClassNotFoundException {
FileInputStream fin = new FileInputStream(fileName);
ObjectInputStream oin = new ObjectInputStream(new BufferedInputStream(fin));
Root root = (Root) oin.readObject();
oin.close();
return root;
}
Aggregations