code: public static InputStream getClassAsStream(Class<?> cl) {
      String name = cl.getName();
      int pos = name.lastIndexOf('.');
      String resourceName = name.substring(pos + 1) + ".class";
      return cl.getResourceAsStream(resourceName);
    }
docs: Gets an <code>InputStream</code> from which the specified class'
  bytecode definition may be read.
  @param cl The <code>Class</code> for which to get the stream.
  @return An <code>InputStream</code> from which the specified class'
  bytecode definition may be read.