List of utility methods to do Object Serialize
byte[] | serialize(Object object) Serialize the specified object ByteArrayOutputStream bstream = new ByteArrayOutputStream(); ObjectOutputStream ostream = new ObjectOutputStream(bstream); ostream.writeObject(object); return bstream.toByteArray(); |
byte[] | serialize(Object object) serialize ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); serialize(object, outputStream); return outputStream.toByteArray(); |
byte[] | serialize(Object object) serialize ObjectOutputStream oos = null; ByteArrayOutputStream baos = null; if (null == object) return null; try { baos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(baos); oos.writeObject(object); ... |
byte[] | serialize(Object object) Serialize the given object to a byte array. if (object == null) { return null; ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); try { ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(object); oos.flush(); ... |
byte[] | serialize(Object object) serialize if (object == null) { return null; ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); try { ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(object); oos.flush(); ... |
byte[] | serialize(Object object) serialize ObjectOutputStream oos = null; ByteArrayOutputStream baos = null; try { if (object != null) { baos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(baos); oos.writeObject(object); return baos.toByteArray(); ... |
byte[] | serialize(Object object, boolean zipped) Serialize one object. ByteArrayOutputStream bo = new ByteArrayOutputStream(); ObjectOutputStream oo; if (zipped) { oo = new ObjectOutputStream(new GZIPOutputStream(bo)); } else { oo = new ObjectOutputStream(bo); oo.writeObject(object); ... |
void | serialize(Object object, File file) Serialise a given object into a given file try { FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(fos); try { oos.writeObject(object); oos.flush(); } finally { try { ... |
void | serialize(Object object, File file) serialize try { serialize(object, new FileOutputStream(file)); } catch (final FileNotFoundException e) { throw new IllegalArgumentException("File must exist.", e); |
boolean | serialize(Object object, String fileName) Serialize an object into a file if the file does not exist yet File file = new File(fileName); if (file.exists()) return false; else { FileOutputStream fos = null; BufferedOutputStream bos = null; ObjectOutputStream oos = null; try { ... |