Java Utililty Methods ObjectOutputStream Write

List of utility methods to do ObjectOutputStream Write

Description

The list of methods to do ObjectOutputStream Write are organized into topic(s).

Method

voidsave(File f, T o)
save
ObjectOutputStream writer = null;
try {
    writer = new ObjectOutputStream(new FileOutputStream(f));
    writer.writeObject(o);
} catch (IOException e) {
    e.printStackTrace();
} catch (Exception e) {
    e.printStackTrace();
...
byte[]save(Object o)
Serializes the object to a byte array.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
save(o, baos);
return baos.toByteArray();
voidsave(Object obj, String path)
save
File f = new File(path);
FileOutputStream fos = new FileOutputStream(f);
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fos);
objectOutputStream.writeObject(obj);
objectOutputStream.close();
voidsave(Serializable serialized, String filepath)
save
save(serialized, new File(filepath));
booleansave(String name, Serializable object)
Save the given object into memory under a File called by the given name.dat.
try {
    OutputStream file = new FileOutputStream(getFile(name));
    OutputStream buffer = new BufferedOutputStream(file);
    try (ObjectOutput output = new ObjectOutputStream(buffer)) {
        output.writeObject(object);
        return true;
} catch (IOException ignored) {
...
voidsaveAllPlaying(Object obj, String path)
Used for saving the ParkourSessions.
try {
    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path));
    oos.writeObject(obj);
    oos.flush();
    oos.close();
} catch (Exception ex) {
    ex.printStackTrace();
voidsaveBinary(File dumpFile, Object object)
save Binary
try {
    ObjectOutputStream objStream = new ObjectOutputStream(new FileOutputStream(dumpFile));
    objStream.writeObject(object);
    objStream.close();
} catch (IOException e) {
    throw new RuntimeException(e);
voidsaveCompressed(String filename, Object o)
save Compressed
saveCompressed(new File(filename), o);
voidsaveData(HashMap data, String filename)
save Data
try {
    writeObject(data, filename);
} catch (IOException e) {
    e.printStackTrace();
booleansaveData(Object data, String filename)
save Data
try {
    FileOutputStream fo = new FileOutputStream(filename);
    ObjectOutputStream oo = new ObjectOutputStream(fo);
    oo.writeObject(data);
    oo.close();
    fo.close();
} catch (Exception e) {
    return false;
...