/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
{
boolean awaitingFetch = false;
int i = 0;
i++;
}
return i;
}
synchronized int countConsumers() {
int i = countConsumers(consumers);
}
return i;
}
addConsumer(ic, false);
}
}
}
}
}
checkSecurity(null, false);
// This consumer is already being fed.
return;
}
}
}
} else {
}
// If there are two different security contexts that both
// have a handle on the same ImageConsumer, then there has
// been a security breach and whether or not they trade
// image data is small fish compared to what they could be
// trading. Throw a Security exception anyway...
errorConsumer(cq, false);
throw new SecurityException("Applets are trading image data!");
}
}
cq.interested = true;
}
}
}
return true;
}
}
}
if (cq.interested) {
}
}
}
}
}
}
}
addConsumer(ic, true);
}
private synchronized void startProduction() {
if (!awaitingFetch) {
if (ImageFetcher.add(this)) {
awaitingFetch = true;
} else {
errorAllConsumers(cq, false);
}
}
}
private synchronized void stopProduction() {
if (awaitingFetch) {
ImageFetcher.remove(this);
awaitingFetch = false;
}
}
}
// Don't believe the content type - file extensions can
// lie.
/*
return new GifImageDecoder(this, is);
return new JPEGImageDecoder(this, is);
return new XbmImageDecoder(this, is);
}
else if (content_type == URL.content_jpeg) {
return new JpegImageDecoder(this, is);
} else if (content_type == URL.content_xbitmap) {
return new XbmImageDecoder(this, is);
} else if (content_type == URL.content_xpixmap) {
return new Xpm2ImageDecoder(this, is);
}
*/
return null;
}
if (!is.markSupported())
try {
/* changed to support png
is.mark(6);
*/
// added to support png
// end of adding
return new GifImageDecoder(this, is);
return new JPEGImageDecoder(this, is);
return new XbmImageDecoder(this, is);
// } else if (c1 == '!' && c2 == ' ' && c3 == 'X' && c4 == 'P' &&
// c5 == 'M' && c6 == '2') {
// return new Xpm2ImageDecoder(this, is);
// added to support png
return new PNGImageDecoder(this, is);
}
// end of adding
} catch (IOException e) {
}
return null;
}
public void doFetch() {
synchronized (this) {
awaitingFetch = false;
return;
}
}
badDecoder();
} else {
try {
imgd.produceImage();
} catch (IOException e) {
e.printStackTrace();
// the finally clause will send an error.
} catch (ImageFormatException e) {
e.printStackTrace();
// the finally clause will send an error.
} finally {
} else {
}
}
}
}
private void badDecoder() {
synchronized (this) {
awaitingFetch = false;
}
errorAllConsumers(cq, false);
}
synchronized (this) {
awaitingFetch = false;
}
if (cq.interested) {
// Now that there is a decoder, security may have changed
// so reverify it here, just in case.
errorConsumer(cq, false);
}
}
}
}
} else {
}
break;
}
}
}
}
}
}
}
synchronized void flush() {
}
}