Class URLProtocolManager


  • public class URLProtocolManager
    extends java.lang.Object
    This class manages URL protocols that we have handlers for. It is used (and called from) the Native code that integrates with FFMPEG. To register a handler you would use the singleton manager as follows:
      URLProtocolManager mgr = URLProtocolManager.getManager();
      mgr.registerFactory("myprotocol", myProtocolHandlerFactory);
     
    • Method Detail

      • init

        public static void init()
        Method to be called to initialize this library.
      • registerFactory

        public IURLProtocolHandlerFactory registerFactory​(java.lang.String protocol,
                                                          IURLProtocolHandlerFactory factory)
        Register a new factory for IURLProtocolHandlers for a given protocol.

        FFMPEG is very picky; protocols must be only alpha characters (no numbers).

        Parameters:
        protocol - The protocol, without colon, this factory is to be used for.
        factory - The factory for the manager to use whenever a handler is requested for a registered protocol; null means disable handling for this factory.
        Returns:
        The factory that was previously used for that protocol (or null if none).
      • getResourceFromURL

        public static java.lang.String getResourceFromURL​(java.lang.String url)
        Get the resource portion of a url. For example for the URL
         http://www.avpkit.com/core
         
        The protocol string is http and the resource string is www.avpkit.com/core
        Parameters:
        url - The url to parse
        Returns:
        The resource
      • getProtocolFromURL

        public static java.lang.String getProtocolFromURL​(java.lang.String url)
        Get the protocol portion of a url. For example for the URL
         http://www.avpkit.com/core
         
        The protocol string is http and the resource string is //www.avpkit.com/core
        Parameters:
        url - The url to parse
        Returns:
        The protocol