List of utility methods to do ObjectOutputStream Write
void | saveDate(String path, Object obj) save Date File file = new File(DEF_DATA_DIR + File.separator + path); try { ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file)); out.writeObject(obj); out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); ... |
void | saveFile(Object o, File file) save File try { FileOutputStream ostream = new FileOutputStream(file); BufferedOutputStream bostream = new BufferedOutputStream(ostream); ObjectOutputStream p = new ObjectOutputStream(bostream); p.writeObject(o); p.flush(); ostream.close(); } catch (IOException e) { ... |
boolean | saveFile(Object o, String filename) save File FileOutputStream fos = null; ObjectOutputStream oos = null; boolean success = false; try { fos = new FileOutputStream(DATA_DIR + filename); oos = new ObjectOutputStream(fos); oos.writeObject(o); success = true; ... |
boolean | saveGZipObject(Object toSave, File file) save G Zip Object FileOutputStream fos = null; GZIPOutputStream gos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream(file); gos = new GZIPOutputStream(fos); oos = new ObjectOutputStream(gos); oos.writeObject(toSave); ... |
boolean | saveIndex(String path, Serializable obj) save Index path += "." + EXTENSION; boolean res = true; File file = new File(path); if (file.exists() && file.isFile()) { if (file.delete()) { System.out.println("deleted ori index"); FileOutputStream fos = null; try { fos = new FileOutputStream(path); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(obj); oos.close(); if (OS.indexOf("win") >= 0) { Runtime.getRuntime().exec("attrib +H " + path); } catch (IOException e) { e.printStackTrace(); res = false; } finally { try { if (fos != null) fos.close(); } catch (IOException e) { e.printStackTrace(); return res; |
void | saveInSerFile(String filename, T object) save In Ser File ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(new File(filename))); try { output.writeObject(object); } finally { output.close(); |
void | saveObject(File file, Object o, boolean overwrite) save Object ObjectOutputStream oos = null; if (file.exists() && !overwrite) { throw new IOException("file exists: " + file.getCanonicalPath()); try { oos = new ObjectOutputStream(new FileOutputStream(file)); oos.writeObject(o); } finally { ... |
void | saveObject(File file, Serializable obj) save Object objToStream(new BufferedOutputStream(new FileOutputStream(file)), obj); |
void | saveObject(Object o, File f) save Object try { FileOutputStream fout = new FileOutputStream(f); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(o); oos.close(); } catch (Exception e) { throw new RuntimeException(e); |
void | saveObject(Object obj, File file) save Object try { ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(file)); stream.writeObject(obj); stream.close(); } catch (IOException e) { e.printStackTrace(); |