javajs.util.AjaxURLStreamHandlerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmol Show documentation
Show all versions of jmol Show documentation
Jmol: an open-source Java viewer for chemical structures in 3D
package javajs.util;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
import java.util.Hashtable;
import java.util.Map;
/**
*
* For handling URL file IO via AJAX in JavaScript version
*
*/
public class AjaxURLStreamHandlerFactory implements URLStreamHandlerFactory {
Map htFactories = new Hashtable();
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
AjaxURLStreamHandler fac = htFactories.get(protocol);
if (fac == null)
htFactories.put(protocol, fac = new AjaxURLStreamHandler(protocol));
return (fac.protocol == null ? null : fac);
}
}