src/org/kocakosm/pitaya/io/ObjectCodec.java
public static byte[] encode(Serializable object)
	{
		Parameters.checkNotNull(object);
		ObjectOutputStream oos = null;
		try {
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			oos = new ObjectOutputStream(out);
			oos.writeObject(object);
			oos.flush();
			return out.toByteArray();
		} catch (IOException ex) {
			throw new EncodingException(ex);
		} finally {
			IO.close(oos);
		}
	}
public static byte[] encode(Serializable object)
	{
		Parameters.checkNotNull(object);
		ObjectOutputStream oos = null;
		try {
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			oos = new ObjectOutputStream(out);
			oos.writeObject(object);
			oos.flush();
			return out.toByteArray();
		} catch (IOException ex) {
			throw new EncodingException(ex);
		} finally {
			IO.close(oos);
		}
	}
public static byte [ ] encode ( Serializable object ) { Parameters . checkNotNull ( object ) ; ObjectOutputStream oos = null ; try { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; oos = new ObjectOutputStream ( out ) ; oos . writeObject ( object ) ; oos . flush ( ) ; return out . toByteArray ( ) ; } catch ( IOException ex ) { throw new EncodingException ( ex ) ; } finally { IO . close ( oos ) ; } }
Serializes the given {@code Serializable} object into an array of
{@code byte}s.

@param object the object to encode.

@return the given object's encoding.

@throws NullPointerException if {@code object} is {@code null}.
@throws EncodingException if the given object cannot be serialized.
Serializes the given { @code Serializable } object into an array of { @code byte } s .