Java Object Save writeObject(File file, Object object)

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

Description

write Object

License

Open Source License

Declaration

public static void writeObject(File file, Object object) 

Method Source Code


//package com.java2s;
/*// www  .j  ava2 s.c o  m
 * Copyright 2016 janobono. All rights reserved.
 * Use of this source code is governed by a Apache 2.0
 * license that can be found in the LICENSE file.
 */

import java.io.*;

public class Main {
    public static void writeObject(File file, Object object) {
        try (ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(file))) {
            outputStream.writeObject(object);
            outputStream.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. writeObject(File f, Serializable obj)
  2. writeObject(File file, Object obj)
  3. writeObject(File file, Object object)
  4. writeObject(File file, Object object)
  5. writeObject(File file, Object object)
  6. writeObject(File file, Object object)
  7. writeObject(File outFile, Object data)
  8. writeObject(Object data, String filename)
  9. writeObject(Object i)