Checking instanceof on objectinputstream to allow for different inputs