Java Code Examples for com.jme3.network.serializing.Serializer#readClassAndObject()
The following examples show how to use
com.jme3.network.serializing.Serializer#readClassAndObject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RmiSerializer.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private RemoteMethodCallMessage readMethodCall(ByteBuffer buffer) throws IOException{ RemoteMethodCallMessage call = new RemoteMethodCallMessage(); call.objectId = buffer.getShort(); call.methodId = buffer.getShort(); call.invocationId = buffer.getShort(); int numArgs = buffer.get() & 0xff; if (numArgs > 0){ Object[] args = new Object[numArgs]; for (int i = 0; i < numArgs; i++){ if (buffer.get() == (byte)0x01){ args[i] = Serializer.readClassAndObject(buffer); } } call.args = args; } return call; }
Example 2
Source File: RmiSerializer.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private RemoteMethodCallMessage readMethodCall(ByteBuffer buffer) throws IOException{ RemoteMethodCallMessage call = new RemoteMethodCallMessage(); call.objectId = buffer.getShort(); call.methodId = buffer.getShort(); call.invocationId = buffer.getShort(); int numArgs = buffer.get() & 0xff; if (numArgs > 0){ Object[] args = new Object[numArgs]; for (int i = 0; i < numArgs; i++){ if (buffer.get() == (byte)0x01){ args[i] = Serializer.readClassAndObject(buffer); } } call.args = args; } return call; }
Example 3
Source File: SerializerMessageProtocol.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Creates and returns a message from the properly sized byte buffer * using com.jme3.network.serializing.Serializer. */ @Override public Message toMessage( ByteBuffer bytes ) { try { return (Message)Serializer.readClassAndObject(bytes); } catch( IOException e ) { throw new RuntimeException("Error deserializing object, class ID:" + bytes.getShort(0), e); } }
Example 4
Source File: RmiSerializer.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private RemoteMethodReturnMessage readMethodReturn(ByteBuffer buffer) throws IOException{ RemoteMethodReturnMessage ret = new RemoteMethodReturnMessage(); ret.invocationID = buffer.getShort(); if (buffer.get() == (byte)0x01){ ret.retVal = Serializer.readClassAndObject(buffer); } return ret; }
Example 5
Source File: MessageProtocol.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Creates a message from the properly sized byte buffer * and adds it to the messages queue. */ protected void createMessage( ByteBuffer buffer ) { try { Object obj = Serializer.readClassAndObject( buffer ); Message m = (Message)obj; messages.add(m); } catch( IOException e ) { throw new RuntimeException( "Error deserializing object", e ); } }
Example 6
Source File: RmiSerializer.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private RemoteMethodReturnMessage readMethodReturn(ByteBuffer buffer) throws IOException{ RemoteMethodReturnMessage ret = new RemoteMethodReturnMessage(); ret.invocationID = buffer.getShort(); if (buffer.get() == (byte)0x01){ ret.retVal = Serializer.readClassAndObject(buffer); } return ret; }