Back to project page hackfmi-ragdoll-physics.
The source code is released under:
GNU General Public License
If you think the Android project hackfmi-ragdoll-physics listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.midtownmadness.bubblecombat.multiplay; /*from w ww . j a va2s . c om*/ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class BluetoothMessage { public MessageType messageType; public Object payload; public BluetoothMessage(MessageType messageType, Object payload) { this.messageType = messageType; this.payload = payload; } @Override public String toString() { return "BluetoothMessage [messageType=" + messageType + ", payload=" + payload + "]"; } public byte[] toBytes() { ByteArrayOutputStream memoryStream = new ByteArrayOutputStream(); try { ObjectOutputStream objectOutputStream = new ObjectOutputStream( memoryStream); objectOutputStream.writeInt(messageType.ordinal()); objectOutputStream.writeObject(payload); } catch (IOException e) { // should never happen! e.printStackTrace(); } return memoryStream.toByteArray(); } }