Code example for ObjectOutputStream

Methods: flush, writeBoolean, writeLong, writeShort

0
	public byte[] marshall(BDBMessage bdbMessage)
	{ 
		try 
		{ 
			UnsynchronizedByteArrayOutputStream bout = new UnsynchronizedByteArrayOutputStream();
			ObjectOutputStream oout = new ObjectOutputStream(bout);
 
			oout.writeShort(bdbMessage.getVersion());
 
			oout.writeLong(bdbMessage.getSequence());
			oout.writeBoolean(bdbMessage.getPreferLocalConsumer());
			oout.writeLong(bdbMessage.getReserveTimeout());
 
			if (bdbMessage.getRawPacket() == null)
			{ 
				serializer.marshal(bdbMessage.getMessage(), oout);
			} 
			else 
			{ 
				oout.write(bdbMessage.getRawPacket());
			} 
 
			oout.flush();
 
			return bout.toByteArray();
		} 
		catch (Throwable t)
		{