Package com.avpkit.core.io
Class URLProtocolManager
- java.lang.Object
-
- com.avpkit.core.io.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);
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_PROTOCOLstatic java.lang.StringNULL_PROTOCOL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IURLProtocolHandlergetHandler(java.lang.String url, int flags)IURLProtocolHandlerFactorygetHandlerFactory(java.lang.String protocol)static URLProtocolManagergetManager()Factory method to get the global protocol manager.static java.lang.StringgetProtocolFromURL(java.lang.String url)Get the protocol portion of a url.static java.lang.StringgetResourceFromURL(java.lang.String url)Get the resource portion of a url.static voidinit()Method to be called to initialize this library.IURLProtocolHandlerFactoryregisterFactory(java.lang.String protocol, IURLProtocolHandlerFactory factory)Register a new factory for IURLProtocolHandlers for a given protocol.
-
-
-
Field Detail
-
DEFAULT_PROTOCOL
public static final java.lang.String DEFAULT_PROTOCOL
- See Also:
- Constant Field Values
-
NULL_PROTOCOL
public static final java.lang.String NULL_PROTOCOL
- See Also:
- Constant Field Values
-
-
Method Detail
-
getManager
public static URLProtocolManager getManager()
Factory method to get the global protocol manager.
-
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).
-
getHandlerFactory
public IURLProtocolHandlerFactory getHandlerFactory(java.lang.String protocol)
-
getHandler
public IURLProtocolHandler getHandler(java.lang.String url, int flags)
-
getResourceFromURL
public static java.lang.String getResourceFromURL(java.lang.String url)
Get the resource portion of a url. For example for the URLhttp://www.avpkit.com/core
The protocol string ishttpand the resource string iswww.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 URLhttp://www.avpkit.com/core
The protocol string ishttpand the resource string is//www.avpkit.com/core- Parameters:
url- The url to parse- Returns:
- The protocol
-
-