1 Clazz.declarePackage ("jssun.awt.image");
2 Clazz.load (["java.awt.image.ImageProducer", "jssun.awt.image.ImageFetchable"], "jssun.awt.image.InputStreamImageSource", ["java.lang.SecurityException", "$.Thread", "jssun.awt.image.ImageConsumerQueue", "$.ImageFetcher"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 this.awaitingFetch = false;
8 Clazz.instantialize (this, arguments);
9 }, jssun.awt.image, "InputStreamImageSource", null, [java.awt.image.ImageProducer, jssun.awt.image.ImageFetchable]);
10 Clazz.defineMethod (c$, "countConsumers",
18 }, "jssun.awt.image.ImageConsumerQueue");
19 Clazz.defineMethod (c$, "countConsumers",
21 var id = this.decoders;
22 var i = this.countConsumers (this.consumers);
24 i += this.countConsumers (id.queue);
29 Clazz.defineMethod (c$, "addConsumer",
31 this.addConsumer (ic, false);
32 }, "java.awt.image.ImageConsumer");
33 Clazz.defineMethod (c$, "printQueue",
34 function (cq, prefix) {
36 System.out.println (prefix + cq);
39 }, "jssun.awt.image.ImageConsumerQueue,~S");
40 Clazz.defineMethod (c$, "printQueues",
42 System.out.println (title + "[ -----------");
43 this.printQueue (this.consumers, " ");
44 for (var id = this.decoders; id != null; id = id.next) {
45 System.out.println (" " + id);
46 this.printQueue (id.queue, " ");
48 System.out.println ("----------- ]" + title);
50 Clazz.defineMethod (c$, "addConsumer",
51 function (ic, produce) {
52 for (var id = this.decoders; id != null; id = id.next) {
53 if (id.isConsumer (ic)) {
56 var cq = this.consumers;
57 while (cq != null && cq.consumer !== ic) {
61 cq = new jssun.awt.image.ImageConsumerQueue (this, ic);
62 cq.next = this.consumers;
67 var security = System.getSecurityManager ();
68 if (security != null) {
69 context = security.getSecurityContext ();
70 }if (cq.securityContext == null) {
71 cq.securityContext = context;
72 } else if (!cq.securityContext.equals (context)) {
73 this.errorConsumer (cq, false);
74 throw new SecurityException ("Applets are trading image data!");
75 }}cq.interested = true;
76 }if (produce && this.decoder == null) {
77 this.startProduction ();
78 }}, "java.awt.image.ImageConsumer,~B");
79 Clazz.overrideMethod (c$, "isConsumer",
81 for (var id = this.decoders; id != null; id = id.next) {
82 if (id.isConsumer (ic)) {
85 return jssun.awt.image.ImageConsumerQueue.isConsumer (this.consumers, ic);
86 }, "java.awt.image.ImageConsumer");
87 Clazz.defineMethod (c$, "errorAllConsumers",
88 function (cq, needReload) {
91 this.errorConsumer (cq, needReload);
94 }, "jssun.awt.image.ImageConsumerQueue,~B");
95 Clazz.defineMethod (c$, "errorConsumer",
96 function (cq, needReload) {
97 cq.consumer.imageComplete (1);
98 this.removeConsumer (cq.consumer);
99 }, "jssun.awt.image.ImageConsumerQueue,~B");
100 Clazz.overrideMethod (c$, "removeConsumer",
102 for (var id = this.decoders; id != null; id = id.next) {
103 id.removeConsumer (ic);
105 this.consumers = jssun.awt.image.ImageConsumerQueue.removeConsumer (this.consumers, ic, false);
106 }, "java.awt.image.ImageConsumer");
107 Clazz.defineMethod (c$, "startProduction",
109 this.addConsumer (ic, true);
110 }, "java.awt.image.ImageConsumer");
111 Clazz.defineMethod (c$, "startProduction",
113 if (!this.awaitingFetch) {
114 jssun.awt.image.ImageFetcher.add (this);
115 this.awaitingFetch = true;
117 Clazz.overrideMethod (c$, "requestTopDownLeftRightResend",
119 }, "java.awt.image.ImageConsumer");
120 Clazz.defineMethod (c$, "decoderForType",
121 function (is, content_type) {
123 }, "java.io.InputStream,~S");
124 Clazz.defineMethod (c$, "getDecoder",
127 }, "java.io.InputStream");
128 Clazz.overrideMethod (c$, "doFetch",
131 if (this.consumers == null) {
132 this.awaitingFetch = false;
134 }}var imgd = this.getDecoder ();
138 this.setDecoder (imgd);
140 imgd.produceImage ();
142 if (Clazz.exceptionOf (e$$, java.io.IOException)) {
145 e.printStackTrace ();
147 } else if (Clazz.exceptionOf (e$$, jssun.awt.image.ImageFormatException)) {
150 e.printStackTrace ();
156 this.removeDecoder (imgd);
157 if (Thread.currentThread ().isInterrupted () || !Thread.currentThread ().isAlive ()) {
158 this.errorAllConsumers (imgd.queue, true);
160 this.errorAllConsumers (imgd.queue, false);
163 Clazz.defineMethod (c$, "badDecoder",
168 this.consumers = null;
169 this.awaitingFetch = false;
170 }this.errorAllConsumers (cq, false);
172 Clazz.defineMethod (c$, "setDecoder",
173 function (mydecoder) {
176 mydecoder.next = this.decoders;
177 this.decoders = mydecoder;
178 this.decoder = mydecoder;
180 mydecoder.queue = cq;
181 this.consumers = null;
182 this.awaitingFetch = false;
183 }}, "jssun.awt.image.ImageDecoder");
184 Clazz.defineMethod (c$, "removeDecoder",
185 function (mydecoder) {
186 this.doneDecoding (mydecoder);
188 for (var id = this.decoders; id != null; id = id.next) {
189 if (id === mydecoder) {
190 if (idprev == null) {
191 this.decoders = id.next;
193 idprev.next = id.next;
197 }, "jssun.awt.image.ImageDecoder");
198 Clazz.defineMethod (c$, "doneDecoding",
199 function (mydecoder) {
200 if (this.decoder === mydecoder) {
202 if (this.consumers != null) {
203 this.startProduction ();
204 }}}, "jssun.awt.image.ImageDecoder");
205 Clazz.defineMethod (c$, "latchConsumers",
207 this.doneDecoding (id);
208 }, "jssun.awt.image.ImageDecoder");
209 Clazz.defineMethod (c$, "flush",