List of utility methods to do ObjectOutputStream Write
T | loadData(Class load Data T o = null; try { FileInputStream fi = new FileInputStream(filename); ObjectInputStream oi = new ObjectInputStream(fi); o = expectedClass.cast(oi.readObject()); oi.close(); fi.close(); } catch (Exception e) { ... |
HashMap | loadData(HashMap data, String filename) load Data try { data = (HashMap) readObject(filename); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); return data; ... |
Object | loadGZipObject(File file) load G Zip Object Object obj = null; FileInputStream fis = null; GZIPInputStream gis = null; ObjectInputStream ois = null; try { fis = new FileInputStream(file); gis = new GZIPInputStream(fis); ois = new ObjectInputStream(gis); ... |
void | LoadMatFromFile(double[] mat, String filename) Load Mat From File try { java.io.FileInputStream fis = new java.io.FileInputStream(filename); java.io.ObjectInputStream inStream = new java.io.ObjectInputStream(fis); for (int i = 0; i < mat.length; i++) mat[i] = inStream.readDouble(); inStream.close(); inStream.close(); } catch (IOException e) { ... |
Object | loadObj(String file) load Obj ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file)); Object qa = ois.readObject(); ois.close(); return qa; |
Serializable | loadSerializableFile(File file) load Serializable File Serializable result = null; ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file)); result = (Serializable) ois.readObject(); ois.close(); return result; |
Serializable | loadSerialized(File file) load Serialized try { return loadSerialized(new FileInputStream(file)); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("can't read serialized object from " + file + ": " + e); |
Object | loadSerializedObject(String fileName) load Serialized Object Object object = null; try { InputStream file = new FileInputStream(fileName); InputStream buffer = new BufferedInputStream(file); ObjectInput input = new ObjectInputStream(buffer); try { object = input.readObject(); } finally { ... |
Object | loadSerializedObjectWithExceptions(String fileName) load Serialized Object With Exceptions InputStream file = new FileInputStream(fileName); InputStream buffer = new BufferedInputStream(file); ObjectInput input = new ObjectInputStream(buffer); Object object = input.readObject(); input.close(); return object; |
Map | loadTrace(File file) Loads a trace from the given file. Map<String, Map<Integer, Integer>> classMap = new HashMap<String, Map<Integer, Integer>>(); ObjectInputStream ois; try { ois = new ObjectInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file)))); int numClasses = ois.readInt(); for (int i = 0; i < numClasses; i++) { String className = ois.readUTF(); int numLines = ois.readInt(); ... |