bw-javaxpath-maven-plugin/src/main/java/fr/fastconnect/factory/tibco/bw/javaxpath/XPathResourceBuilderMojo.java
protected byte[] getBytesForClass(final String className)
			throws RuntimeException {
		try {
			ClassLoader classLoader = this.getClass().getClassLoader();
			InputStream stream = classLoader.getResourceAsStream(className
					.replace(".", "/") + ".class");
			if (stream == null) {
				throw new NullPointerException("Class " + className
						+ " could not be loaded. Check plugin dependencies.");
			}
			byte[] byteArray = new byte[1024000];
			int readBytes = 0;
			int currentOffset = 0;
			while ((readBytes = stream.read(byteArray, currentOffset, 1024)) >= 0) {
				currentOffset += readBytes;
			}
			return Arrays.copyOf(byteArray, currentOffset);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
protected byte[] getBytesForClass(final String className)
			throws RuntimeException {
		try {
			ClassLoader classLoader = this.getClass().getClassLoader();
			InputStream stream = classLoader.getResourceAsStream(className
					.replace(".", "/") + ".class");
			if (stream == null) {
				throw new NullPointerException("Class " + className
						+ " could not be loaded. Check plugin dependencies.");
			}
			byte[] byteArray = new byte[1024000];
			int readBytes = 0;
			int currentOffset = 0;
			while ((readBytes = stream.read(byteArray, currentOffset, 1024)) >= 0) {
				currentOffset += readBytes;
			}
			return Arrays.copyOf(byteArray, currentOffset);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
protected byte [ ] getBytesForClass ( final String className ) throws RuntimeException { try { ClassLoader classLoader = this . getClass ( ) . getClassLoader ( ) ; InputStream stream = classLoader . getResourceAsStream ( className . replace ( "." , "/" ) + ".class" ) ; if ( stream == null ) { throw new NullPointerException ( "Class " + className + " could not be loaded. Check plugin dependencies." ) ; } byte [ ] byteArray = new byte [ 1024000 ] ; int readBytes = 0 ; int currentOffset = 0 ; while ( ( readBytes = stream . read ( byteArray , currentOffset , 1024 ) ) >= 0 ) { currentOffset += readBytes ; } return Arrays . copyOf ( byteArray , currentOffset ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Reads a class byte code from current {@link ClassLoader}

@param className
@return
@throws RuntimeException
Reads a class byte code from current { @link ClassLoader }