private void writeType(ByteBuffer buffer, Class<?> clazz) throws IOException{
        if (clazz == void.class){
            buffer.putShort((short)0);
        } else {
            SerializerRegistration reg = Serializer.getSerializerRegistration(clazz);
            if (reg == null){
                logger.log(Level.WARNING, "Unknown class: {0}", clazz);
                throw new IOException(); // prevents message from being serialized
            }
            buffer.putShort(reg.getId());
        }
    }
{@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