1 Clazz.declarePackage ("java.net");
2 Clazz.load (null, "java.net.URLConnection", ["java.lang.IllegalStateException", "$.NullPointerException", "java.net.UnknownServiceException", "JU.Lst"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 this.connected = false;
9 Clazz.instantialize (this, arguments);
10 }, java.net, "URLConnection");
11 Clazz.defineMethod (c$, "setDoInput",
13 if (this.connected) throw new IllegalStateException ("Already connected");
14 this.doInput = doinput;
16 Clazz.defineMethod (c$, "getDoInput",
20 Clazz.defineMethod (c$, "setDoOutput",
22 if (this.connected) throw new IllegalStateException ("Already connected");
23 this.doOutput = dooutput;
25 Clazz.defineMethod (c$, "getDoOutput",
29 Clazz.makeConstructor (c$,
33 Clazz.defineMethod (c$, "getURL",
37 Clazz.defineMethod (c$, "getInputStream",
39 throw new java.net.UnknownServiceException ("protocol doesn't support input");
41 Clazz.defineMethod (c$, "getOutputStream",
43 throw new java.net.UnknownServiceException ("protocol doesn't support output");
45 Clazz.defineMethod (c$, "setRequestProperty",
46 function (key, value) {
47 if (this.connected) throw new IllegalStateException ("Already connected");
48 if (key == null) throw new NullPointerException ("key is null");
49 if (this.requests == null) this.requests = new JU.Lst ();
50 for (var i = this.requests.size (); --i >= 0; ) if (this.requests.get (i)[0].equals (key)) {
51 this.requests.get (i)[1] = value;
54 this.requests.addLast ( Clazz.newArray (-1, [key, value]));