Here you can find the source of serialize(Object obj, OutputStream out)
Parameter | Description |
---|---|
obj | Object to serialize |
out | Where to put serialized object |
Parameter | Description |
---|---|
IOException | Writing to output stream |
public static void serialize(Object obj, OutputStream out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStream; public class Main { /**/*from ww w . ja v a 2 s . c o m*/ * Serialize to output stream * * @param obj * Object to serialize * @param out * Where to put serialized object * @throws IOException * Writing to output stream */ public static void serialize(Object obj, OutputStream out) throws IOException { ObjectOutputStream os = new ObjectOutputStream(out); os.writeObject(obj); } }