Java Object Serialize serialize(final Object object, final File file)

Here you can find the source of serialize(final Object object, final File file)

Description

serialize

License

Apache License

Declaration

public static void serialize(final Object object, final File file) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.ObjectOutputStream;

public class Main {
    public static void serialize(final Object object, final File file) {

        try {/*  w  ww. j  ava2s .com*/
            final FileOutputStream fileOut = new FileOutputStream(file);
            final ObjectOutputStream out = new ObjectOutputStream(fileOut);
            out.writeObject(object);
            out.close();
            fileOut.close();
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }

    }
}

Related

  1. serialize(@Nullable Object value)
  2. serialize(File outFile, Object source)
  3. serialize(final @Nonnull Object obj)
  4. serialize(final File file, final Object o)
  5. serialize(final Object object)
  6. serialize(final Serializable obj)
  7. serialize(final Serializable object)
  8. serialize(final String path, final Object object)
  9. serialize(final String pFilename, final T pObject)