List of utility methods to do ObjectOutputStream Write
void | saveSerializableObject(Object obj, String path) save Serializable Object FileOutputStream fout = new FileOutputStream(path); BufferedOutputStream bout = new BufferedOutputStream(fout); ObjectOutputStream oos = new ObjectOutputStream(bout); try { oos.writeObject(obj); } finally { oos.flush(); oos.close(); ... |
void | saveSerialized(Serializable obj, File file) save Serialized ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file))); out.writeObject(obj); out.close(); |
void | saveStringToFile(String filepath, String content) save String To File ByteArrayInputStream is = new ByteArrayInputStream(content.getBytes()); java.io.FileOutputStream fos = new java.io.FileOutputStream(new File(filepath)); while (is.available() > 0) { fos.write(is.read()); fos.close(); is.close(); |
void | saveToFile(File f, Object obj) save To File try (FileOutputStream fis = new FileOutputStream(f, false)) { fis.write(compress(objectToByte(obj))); fis.flush(); fis.close(); |
void | saveToFile(final File file, final Object obj) save To File final FileOutputStream fileOS = new FileOutputStream(file); try (DataOutputStream dataOS = new DataOutputStream(fileOS)) { dataOS.write(serialize(obj)); dataOS.flush(); |
void | saveToFile(Serializable object, File file, boolean compress) save To File try { OutputStream ostream = new FileOutputStream(file); if (compress) { ostream = new GZIPOutputStream(ostream); ObjectOutputStream stream = new ObjectOutputStream(ostream); stream.writeObject(object); stream.close(); ... |
void | saveToFile(String string, File file, boolean append) save To File FileWriter fw = null; try { fw = new FileWriter(file, append); PrintWriter out = new PrintWriter(fw); out.print(string); out.close(); } catch (IOException ex) { throw ex; ... |