private MethodDef readMethod(ByteBuffer buffer) throws IOException{
        String name = readString(buffer);
        Class<?> retType = readType(buffer);
        
        int numParams = buffer.get() & 0xff;
        Class<?>[] paramTypes = new Class<?>[numParams];
        for (int i = 0; i < numParams; i++){
            paramTypes[i] = readType(buffer);
        }

        MethodDef def = new MethodDef();
        def.name = name;
        def.paramTypes = paramTypes;
        def.retType = retType;
        return def;
    }
{@link RmiSerializer} is responsible for serializing RMI messages
like define object, call, and return.

@author Kirill Vainer
jme3-networking/src/main/java/com/jme3/network/rmi/RmiSerializer.java