byte[] buffer = new byte[255];
for (int len; (len = classStream.read(buffer)) != -1;)
{
jarOutput.write(buffer, 0, len);
}
jarOutput.closeEntry();
// close the JAR archive and return the InputStream
jarOutput.close();
return new ByteArrayInputStream(byteArrayStream.toByteArray());