List of utility methods to do Object Save
byte[] | writeObject(Object i) Returns the byte value of i in a new byte array. byte[] retVal = null; try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream dos = new ObjectOutputStream(bos); dos.writeObject(i); dos.close(); dos.flush(); retVal = bos.toByteArray(); ... |
void | writeObject(Object o, File f) write Object try { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(f)); oos.writeObject(o); oos.close(); } catch (FileNotFoundException e) { System.err.println("Cannot find " + f); e.printStackTrace(); } catch (IOException e) { ... |
void | writeObject(Object o, File path) write Object try { ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(path)); try { out.writeObject(o); } finally { out.close(); } catch (Exception e) { ... |
void | writeObject(Object o, ObjectOutput dos) write Object dos.writeObject(o); |
void | writeObject(Object obj, File path) write Object ObjectOutputStream out = null; try { out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(path))); out.writeObject(obj); out.close(); } catch (IOException e) { System.err.println("Failed to write filename " + path); } finally { ... |
void | writeObject(Object obj, ObjectOutput out) write Object if (obj == null) { out.writeObject(NULL); } else { out.writeObject(NOTNULL); out.writeObject(obj); |
byte[] | writeObject(Object object) Serialize an Object to a ByteArray ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(buffer); out.writeObject(object); out.close(); return buffer.toByteArray(); |
void | writeObject(Object object, File destinationFile) Writes an object to the destination file. FileOutputStream fos = new FileOutputStream(destinationFile.getAbsoluteFile()); try { BufferedOutputStream bos = new BufferedOutputStream(fos); try { ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(object); } finally { ... |
void | writeObject(Object object, String path) write Object FileOutputStream fileOut = null; BufferedOutputStream bufferedOut = null; ObjectOutputStream objectOut = null; try { fileOut = new FileOutputStream(path); bufferedOut = new BufferedOutputStream(fileOut); objectOut = new ObjectOutputStream(bufferedOut); objectOut.writeObject(object); ... |
boolean | writeObject(Object p_object, File p_outFile) Writes an object to a file using object serialization. try { FileOutputStream fStream = new FileOutputStream(p_outFile); ObjectOutputStream oObject = new ObjectOutputStream(fStream); oObject.writeObject(p_object); oObject.close(); fStream.close(); return true; } catch (IOException e) { ... |