Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / net / URLStreamHandler.js
index 4572ad5..d88ca57 100644 (file)
-Clazz.declarePackage ("java.net");\r
-Clazz.load (null, "java.net.URLStreamHandler", ["java.lang.IllegalArgumentException", "$.SecurityException", "$.UnsupportedOperationException"], function () {\r
-c$ = Clazz.declareType (java.net, "URLStreamHandler");\r
-Clazz.defineMethod (c$, "openConnectionProxy", \r
-function (u, p) {\r
-throw  new UnsupportedOperationException ("Method not implemented.");\r
-}, "java.net.URL,java.net.Proxy");\r
-Clazz.defineMethod (c$, "parseURL", \r
-function (u, spec, start, limit) {\r
-var protocol = u.getProtocol ();\r
-var authority = u.getAuthority ();\r
-var userInfo = u.getUserInfo ();\r
-var host = u.getHost ();\r
-var port = u.getPort ();\r
-var path = u.getPath ();\r
-var query = u.getQuery ();\r
-var ref = u.getRef ();\r
-var isRelPath = false;\r
-var queryOnly = false;\r
-if (start < limit) {\r
-var queryStart = spec.indexOf ('?');\r
-queryOnly = queryStart == start;\r
-if ((queryStart != -1) && (queryStart < limit)) {\r
-query = spec.substring (queryStart + 1, limit);\r
-if (limit > queryStart) limit = queryStart;\r
-spec = spec.substring (0, queryStart);\r
-}}var i = 0;\r
-var isUNCName = (start <= limit - 4) && (spec.charAt (start) == '/') && (spec.charAt (start + 1) == '/') && (spec.charAt (start + 2) == '/') && (spec.charAt (start + 3) == '/');\r
-if (!isUNCName && (start <= limit - 2) && (spec.charAt (start) == '/') && (spec.charAt (start + 1) == '/')) {\r
-start += 2;\r
-i = spec.indexOf ('/', start);\r
-if (i < 0) {\r
-i = spec.indexOf ('?', start);\r
-if (i < 0) i = limit;\r
-}host = authority = spec.substring (start, i);\r
-var ind = authority.indexOf ('@');\r
-if (ind != -1) {\r
-userInfo = authority.substring (0, ind);\r
-host = authority.substring (ind + 1);\r
-} else {\r
-userInfo = null;\r
-}if (host != null) {\r
-if (host.length > 0 && (host.charAt (0) == '[')) {\r
-throw  new IllegalArgumentException ("Invalid host: " + host);\r
-}ind = host.indexOf (':');\r
-port = -1;\r
-if (ind >= 0) {\r
-if (host.length > (ind + 1)) {\r
-port = Integer.parseInt (host.substring (ind + 1));\r
-}host = host.substring (0, ind);\r
-}} else {\r
-host = "";\r
-}if (port < -1) throw  new IllegalArgumentException ("Invalid port number :" + port);\r
-start = i;\r
-if (authority.length > 0) path = "";\r
-}if (host == null) {\r
-host = "";\r
-}if (start < limit) {\r
-if (spec.charAt (start) == '/') {\r
-path = spec.substring (start, limit);\r
-} else if (path != null && path.length > 0) {\r
-isRelPath = true;\r
-var ind = path.lastIndexOf ('/');\r
-var seperator = "";\r
-if (ind == -1 && authority != null) seperator = "/";\r
-path = path.substring (0, ind + 1) + seperator + spec.substring (start, limit);\r
-} else {\r
-var seperator = (authority != null) ? "/" : "";\r
-path = seperator + spec.substring (start, limit);\r
-}} else if (queryOnly && path != null) {\r
-var ind = path.lastIndexOf ('/');\r
-if (ind < 0) ind = 0;\r
-path = path.substring (0, ind) + "/";\r
-}if (path == null) path = "";\r
-if (isRelPath) {\r
-while ((i = path.indexOf ("/./")) >= 0) {\r
-path = path.substring (0, i) + path.substring (i + 2);\r
-}\r
-i = 0;\r
-while ((i = path.indexOf ("/../", i)) >= 0) {\r
-if (i > 0 && (limit = path.lastIndexOf ('/', i - 1)) >= 0 && (path.indexOf ("/../", limit) != 0)) {\r
-path = path.substring (0, limit) + path.substring (i + 3);\r
-i = 0;\r
-} else {\r
-i = i + 3;\r
-}}\r
-while (path.endsWith ("/..")) {\r
-i = path.indexOf ("/..");\r
-if ((limit = path.lastIndexOf ('/', i - 1)) >= 0) {\r
-path = path.substring (0, limit + 1);\r
-} else {\r
-break;\r
-}}\r
-if (path.startsWith ("./") && path.length > 2) path = path.substring (2);\r
-if (path.endsWith ("/.")) path = path.substring (0, path.length - 1);\r
-}this.setURL (u, protocol, host, port, authority, userInfo, path, query, ref);\r
-}, "java.net.URL,~S,~N,~N");\r
-Clazz.defineMethod (c$, "getDefaultPort", \r
-function () {\r
-return -1;\r
-});\r
-Clazz.defineMethod (c$, "equals2", \r
-function (u1, u2) {\r
-var ref1 = u1.getRef ();\r
-var ref2 = u2.getRef ();\r
-return (ref1 === ref2 || (ref1 != null && ref1.equals (ref2))) && this.sameFile (u1, u2);\r
-}, "java.net.URL,java.net.URL");\r
-Clazz.defineMethod (c$, "hashCode", \r
-function (u) {\r
-var h = 0;\r
-var protocol = u.getProtocol ();\r
-if (protocol != null) h += protocol.hashCode ();\r
-h += u.toString ().hashCode ();\r
-var file = u.getFile ();\r
-if (file != null) h += file.hashCode ();\r
-if (u.getPort () == -1) h += this.getDefaultPort ();\r
- else h += u.getPort ();\r
-var ref = u.getRef ();\r
-if (ref != null) h += ref.hashCode ();\r
-return h;\r
-}, "java.net.URL");\r
-Clazz.defineMethod (c$, "sameFile", \r
-function (u1, u2) {\r
-if (!((u1.getProtocol () === u2.getProtocol ()) || (u1.getProtocol () != null && u1.getProtocol ().equalsIgnoreCase (u2.getProtocol ())))) return false;\r
-if (!(u1.getFile () === u2.getFile () || (u1.getFile () != null && u1.getFile ().equals (u2.getFile ())))) return false;\r
-var port1;\r
-var port2;\r
-port1 = (u1.getPort () != -1) ? u1.getPort () : u1.handler.getDefaultPort ();\r
-port2 = (u2.getPort () != -1) ? u2.getPort () : u2.handler.getDefaultPort ();\r
-if (port1 != port2) return false;\r
-if (!this.hostsEqual (u1, u2)) return false;\r
-return true;\r
-}, "java.net.URL,java.net.URL");\r
-Clazz.defineMethod (c$, "hostsEqual", \r
-function (u1, u2) {\r
-if (u1.getHost () != null && u2.getHost () != null) return u1.getHost ().equalsIgnoreCase (u2.getHost ());\r
-return u1.getHost () == null && u2.getHost () == null;\r
-}, "java.net.URL,java.net.URL");\r
-Clazz.defineMethod (c$, "toExternalForm", \r
-function (u) {\r
-return "";\r
-}, "java.net.URL");\r
-Clazz.defineMethod (c$, "setURL", \r
-function (u, protocol, host, port, authority, userInfo, path, query, ref) {\r
-if (this !== u.handler) {\r
-throw  new SecurityException ("handler for url different from this handler");\r
-}u.set (u.getProtocol (), host, port, authority, userInfo, path, query, ref);\r
-}, "java.net.URL,~S,~S,~N,~S,~S,~S,~S,~S");\r
-Clazz.defineMethod (c$, "setURLDeprecated", \r
-function (u, protocol, host, port, file, ref) {\r
-var authority = null;\r
-var userInfo = null;\r
-if (host != null && host.length != 0) {\r
-authority = (port == -1) ? host : host + ":" + port;\r
-var at = host.lastIndexOf ('@');\r
-if (at != -1) {\r
-userInfo = host.substring (0, at);\r
-host = host.substring (at + 1);\r
-}}var path = null;\r
-var query = null;\r
-if (file != null) {\r
-var q = file.lastIndexOf ('?');\r
-if (q != -1) {\r
-query = file.substring (q + 1);\r
-path = file.substring (0, q);\r
-} else path = file;\r
-}this.setURL (u, protocol, host, port, authority, userInfo, path, query, ref);\r
-}, "java.net.URL,~S,~S,~N,~S,~S");\r
-});\r
+Clazz.declarePackage ("java.net");
+Clazz.load (null, "java.net.URLStreamHandler", ["java.lang.IllegalArgumentException", "$.SecurityException", "$.UnsupportedOperationException"], function () {
+c$ = Clazz.declareType (java.net, "URLStreamHandler");
+Clazz.defineMethod (c$, "openConnectionProxy", 
+function (u, p) {
+throw  new UnsupportedOperationException ("Method not implemented.");
+}, "java.net.URL,java.net.Proxy");
+Clazz.defineMethod (c$, "parseURL", 
+function (u, spec, start, limit) {
+var protocol = u.getProtocol ();
+var authority = u.getAuthority ();
+var userInfo = u.getUserInfo ();
+var host = u.getHost ();
+var port = u.getPort ();
+var path = u.getPath ();
+var query = u.getQuery ();
+var ref = u.getRef ();
+var isRelPath = false;
+var queryOnly = false;
+if (start < limit) {
+var queryStart = spec.indexOf ('?');
+queryOnly = queryStart == start;
+if ((queryStart != -1) && (queryStart < limit)) {
+query = spec.substring (queryStart + 1, limit);
+if (limit > queryStart) limit = queryStart;
+spec = spec.substring (0, queryStart);
+}}var i = 0;
+var isUNCName = (start <= limit - 4) && (spec.charAt (start) == '/') && (spec.charAt (start + 1) == '/') && (spec.charAt (start + 2) == '/') && (spec.charAt (start + 3) == '/');
+if (!isUNCName && (start <= limit - 2) && (spec.charAt (start) == '/') && (spec.charAt (start + 1) == '/')) {
+start += 2;
+i = spec.indexOf ('/', start);
+if (i < 0) {
+i = spec.indexOf ('?', start);
+if (i < 0) i = limit;
+}host = authority = spec.substring (start, i);
+var ind = authority.indexOf ('@');
+if (ind != -1) {
+userInfo = authority.substring (0, ind);
+host = authority.substring (ind + 1);
+} else {
+userInfo = null;
+}if (host != null) {
+if (host.length > 0 && (host.charAt (0) == '[')) {
+throw  new IllegalArgumentException ("Invalid host: " + host);
+}ind = host.indexOf (':');
+port = -1;
+if (ind >= 0) {
+if (host.length > (ind + 1)) {
+port = Integer.parseInt (host.substring (ind + 1));
+}host = host.substring (0, ind);
+}} else {
+host = "";
+}if (port < -1) throw  new IllegalArgumentException ("Invalid port number :" + port);
+start = i;
+if (authority.length > 0) path = "";
+}if (host == null) {
+host = "";
+}if (start < limit) {
+if (spec.charAt (start) == '/') {
+path = spec.substring (start, limit);
+} else if (path != null && path.length > 0) {
+isRelPath = true;
+var ind = path.lastIndexOf ('/');
+var seperator = "";
+if (ind == -1 && authority != null) seperator = "/";
+path = path.substring (0, ind + 1) + seperator + spec.substring (start, limit);
+} else {
+var seperator = (authority != null) ? "/" : "";
+path = seperator + spec.substring (start, limit);
+}} else if (queryOnly && path != null) {
+var ind = path.lastIndexOf ('/');
+if (ind < 0) ind = 0;
+path = path.substring (0, ind) + "/";
+}if (path == null) path = "";
+if (isRelPath) {
+while ((i = path.indexOf ("/./")) >= 0) {
+path = path.substring (0, i) + path.substring (i + 2);
+}
+i = 0;
+while ((i = path.indexOf ("/../", i)) >= 0) {
+if (i > 0 && (limit = path.lastIndexOf ('/', i - 1)) >= 0 && (path.indexOf ("/../", limit) != 0)) {
+path = path.substring (0, limit) + path.substring (i + 3);
+i = 0;
+} else {
+i = i + 3;
+}}
+while (path.endsWith ("/..")) {
+i = path.indexOf ("/..");
+if ((limit = path.lastIndexOf ('/', i - 1)) >= 0) {
+path = path.substring (0, limit + 1);
+} else {
+break;
+}}
+if (path.startsWith ("./") && path.length > 2) path = path.substring (2);
+if (path.endsWith ("/.")) path = path.substring (0, path.length - 1);
+}this.setURL (u, protocol, host, port, authority, userInfo, path, query, ref);
+}, "java.net.URL,~S,~N,~N");
+Clazz.defineMethod (c$, "getDefaultPort", 
+function () {
+return -1;
+});
+Clazz.defineMethod (c$, "equals2", 
+function (u1, u2) {
+var ref1 = u1.getRef ();
+var ref2 = u2.getRef ();
+return (ref1 === ref2 || (ref1 != null && ref1.equals (ref2))) && this.sameFile (u1, u2);
+}, "java.net.URL,java.net.URL");
+Clazz.defineMethod (c$, "hashCode", 
+function (u) {
+var h = 0;
+var protocol = u.getProtocol ();
+if (protocol != null) h += protocol.hashCode ();
+h += u.toString ().hashCode ();
+var file = u.getFile ();
+if (file != null) h += file.hashCode ();
+if (u.getPort () == -1) h += this.getDefaultPort ();
+ else h += u.getPort ();
+var ref = u.getRef ();
+if (ref != null) h += ref.hashCode ();
+return h;
+}, "java.net.URL");
+Clazz.defineMethod (c$, "sameFile", 
+function (u1, u2) {
+if (!((u1.getProtocol () === u2.getProtocol ()) || (u1.getProtocol () != null && u1.getProtocol ().equalsIgnoreCase (u2.getProtocol ())))) return false;
+if (!(u1.getFile () === u2.getFile () || (u1.getFile () != null && u1.getFile ().equals (u2.getFile ())))) return false;
+var port1;
+var port2;
+port1 = (u1.getPort () != -1) ? u1.getPort () : u1.handler.getDefaultPort ();
+port2 = (u2.getPort () != -1) ? u2.getPort () : u2.handler.getDefaultPort ();
+if (port1 != port2) return false;
+if (!this.hostsEqual (u1, u2)) return false;
+return true;
+}, "java.net.URL,java.net.URL");
+Clazz.defineMethod (c$, "hostsEqual", 
+function (u1, u2) {
+if (u1.getHost () != null && u2.getHost () != null) return u1.getHost ().equalsIgnoreCase (u2.getHost ());
+return u1.getHost () == null && u2.getHost () == null;
+}, "java.net.URL,java.net.URL");
+Clazz.defineMethod (c$, "toExternalForm", 
+function (u) {
+return "";
+}, "java.net.URL");
+Clazz.defineMethod (c$, "setURL", 
+function (u, protocol, host, port, authority, userInfo, path, query, ref) {
+if (this !== u.handler) {
+throw  new SecurityException ("handler for url different from this handler");
+}u.set (u.getProtocol (), host, port, authority, userInfo, path, query, ref);
+}, "java.net.URL,~S,~S,~N,~S,~S,~S,~S,~S");
+Clazz.defineMethod (c$, "setURLDeprecated", 
+function (u, protocol, host, port, file, ref) {
+var authority = null;
+var userInfo = null;
+if (host != null && host.length != 0) {
+authority = (port == -1) ? host : host + ":" + port;
+var at = host.lastIndexOf ('@');
+if (at != -1) {
+userInfo = host.substring (0, at);
+host = host.substring (at + 1);
+}}var path = null;
+var query = null;
+if (file != null) {
+var q = file.lastIndexOf ('?');
+if (q != -1) {
+query = file.substring (q + 1);
+path = file.substring (0, q);
+} else path = file;
+}this.setURL (u, protocol, host, port, authority, userInfo, path, query, ref);
+}, "java.net.URL,~S,~S,~N,~S,~S");
+});