code: public static byte[] getBytesFor(String name, Class<?> cls)
  	{
  		InputStream in = null;
  
  		try
  		{
  			if((in = getFor(name, cls))==null)
  				throw new ResourceException("Unablet to find package resource for " + name + " and " + cls);
  			return IOUtils.toByteArray(in);
  		}
  		catch(IOException e)
  		{
  			throw new ResourceException("IOException reading resource");
  		}
  		finally
  		{
  			Closer.close(in,logger,"resource InputStream");
  		}
  	}
docs: Get a resource as a byte array.
  @param name The name of the resource
  @param cls the class to use for the package name
  @return The contents of the resource as a byte array.
  @throws NullPointerException if name or cls are null.
  ResourceException if the resource cannot be found.