Java OutputStream Write serialize(Serializable obj, ByteArrayOutputStream bout)

Here you can find the source of serialize(Serializable obj, ByteArrayOutputStream bout)

Description

Serialize the given object into the given stream

License

Open Source License

Declaration

public static void serialize(Serializable obj, ByteArrayOutputStream bout) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayOutputStream;

import java.io.IOException;

import java.io.ObjectOutputStream;

import java.io.Serializable;

public class Main {
    /** Serialize the given object into the given stream */
    public static void serialize(Serializable obj, ByteArrayOutputStream bout) {
        try {/*from   ww  w  . j  a va 2s.  c  o m*/
            ObjectOutputStream out = new ObjectOutputStream(bout);
            out.writeObject(obj);
            out.close();
        } catch (IOException e) {
            throw new IllegalStateException("Could not serialize " + obj, e);
        }
    }
}

Related

  1. serialize(Object obj, OutputStream out)
  2. serialize(Object object, OutputStream out)
  3. serialize(Object value, OutputStream targetOutputStream)
  4. serialize(OutputStream os, String... params)
  5. serialize(OutputStream out, Object obj)
  6. serialize(Serializable obj, OutputStream outputStream)
  7. serialize(Serializable obj, OutputStream outputStream)
  8. serialize(Serializable s, OutputStream os)
  9. serializeInt(int i, DataOutputStream dout)