code: public <T extends FastSerializable> T readObject(final Class<T> expectedType) throws IOException {
          assert(expectedType != null);
          T obj = null;
          try {
              obj = expectedType.newInstance();
              obj.readExternal(this);
          } catch (final InstantiationException e) {
              e.printStackTrace();
          } catch (final IllegalAccessException e) {
              e.printStackTrace();
          }
          return obj;
      }
docs: Read an object from a a byte array stream assuming you know the expected type.
  
  @param expectedType The class of the type to be deserialized.
  @return A derserialized object.
  @throws IOException Rethrows any IOExceptions thrown.