public CacheReference fetchURICache(URI sourceURI) {
    synchronized (uriCache) {
      WeakReference<CacheReference> ref = uriCache.get(sourceURI);
      if (null == ref) {
        return null;
      }

      CacheReference cacheData = ref.get();
      if (null != cacheData) {
        if (Logger.canLog(Logger.DEBUG)) {
          Logger.logMsg(
              Logger.DEBUG,
              "Fetched cache entry: URI "
                  + sourceURI
                  + ", buffer "
                  + cacheData.getBuffer()
                  + ", MIME type "
                  + cacheData.getMIMEType());
        }

        return cacheData;
      }
    }
    return null;
  }
  /*
   * MIME type is cached so that Locator doesn't need to talk to the server,
   * it can just get the type and buffer and be done
   */
  public CacheReference registerURICache(URI sourceURI, ByteBuffer data, String mimeType) {
    if (Logger.canLog(Logger.DEBUG)) {
      Logger.logMsg(
          Logger.DEBUG,
          "New cache entry: URI " + sourceURI + ", buffer " + data + ", MIME type " + mimeType);
    }

    // ensure the given ByteBuffer is a direct buffer, required for native access
    if (!data.isDirect()) {
      data.rewind();
      ByteBuffer newData = ByteBuffer.allocateDirect(data.capacity());
      newData.put(data);
      data = newData;
    }

    CacheReference ref = new CacheReference(data, mimeType);
    synchronized (uriCache) {
      uriCache.put(sourceURI, new WeakReference(ref));
    }

    // Now register sourceURI with the disposer so we can remove it
    // from uriCache when our cache entry gets collected
    MediaDisposer.addResourceDisposer(ref, sourceURI, cacheDisposer);
    return ref;
  }