data-url
The data-url library adds support for the data protocol as specified in RFC 2397.
There are several ways to create data URLs. Most are described by the URL class.
- Make use of a shared URLStreamHandlerFactory set on the URL class. This must return an instance of Handler for the
dataprotocol. - Add package
com.github.robtimus.net.protocolto system propertyjava.protocol.handler.pkgs. - Use this URL constructor, and provide an instance of Handler as the URLStreamHandler. The
contextargument can remainnull.- It's ill-advised to use this constructor, because it does not ensure the data URL is correctly formatted.
- Use utility class DataURLs.
Note that class Handler is stateless, and therefore instances can be shared among multiple threads.