code: public static <T extends BitReadable> T readObject(final BitInput input, final Class<T> type) throws IOException {
          if (input == null) {
              throw new NullPointerException("input is null");
          }
          if (type == null) {
              throw new NullPointerException("type is null");
          }
          try {
              final Constructor<T> constructor = type.getDeclaredConstructor();
              if (!constructor.isSynthetic()) {
                  constructor.setAccessible(true);
              }
              try {
                  final T value = constructor.newInstance();
                  value.read(input);
                  return value;
              } catch (final IllegalAccessException iae) {
                  throw new RuntimeException(iae);
              } catch (final InstantiationException ie) {
                  throw new RuntimeException(ie);
              } catch (final InvocationTargetException ite) {
                  throw new RuntimeException(ite);
              }
          } catch (final NoSuchMethodException nsme) {
              throw new RuntimeException(nsme);
          }
      }
docs: -----------------------------------------------------------------------------------------------------------------