code: public static byte[] getIntoByteArray(Cache cache, String resource, CacheMissHandler ... handlers) throws CacheException {
  		if(cache == null) {
  			logger.error("cache reference must not be null");
  			throw new CacheException("invalid cache");
  		}
  		InputStream input = null;
  		ByteArrayOutputStream output = null; 
  		try {
  			input = cache.get(resource, handlers);
  			if(input != null) {
  				output = new ByteArrayOutputStream();
  				long copied = Streams.copy(input, output);
  				logger.trace("copied {} bytes from cache", copied);
  				return output.toByteArray();
  			}			
  		} catch (IOException e) {
  			logger.error("error copying data from cache to byte array", e);
  			throw new CacheException("error copying data from cache to byte array", e);
  		} finally {
  			Streams.safelyClose(input);
  			Streams.safelyClose(output);
  		}
  		return null;
  	}
docs: Retrieves the given resource from the cache and translate it to a byte
  array; if missing tries to retrieve it using the (optional) provided set
  of handlers.
  
  @param cache
  the cache that stores the resource.
  @param resource
  the name of the resource to be retrieved.
  @param handlers
  the (optional) set of handlers that will attempt to retrieve the resource
  if missing from the cache.
  @return
  the resource as an array of bytes, or {@code null} if it cannot be
  retrieved.
  @throws CacheException