Applet and imageIO

N

news.skynet.be

Hello I have written an application and used a code example to write a
buffered image to an image to a byteArrayOutput stream.

The error that I get is a
sun.misc.serviceConfigurationError.javax.imageit.spiImageOutputStream.

Really I don't understand this error!?!? what is this telling me is the main
question.

Everything works fine when I run it as an application but when I run it as
an applet I get this error:

quote:
sun.misc.ServiceConfigurationError:
javax.imageio.spi.ImageOutputStreamSpi:
http://127.0.0.1:8500/projects/loop...ices/javax.imageio.spi.ImageOutputStreamSpi:1:
Illegal configuration-file syntax

at sun.misc.Service.fail(Unknown Source)

at sun.misc.Service.fail(Unknown Source)

at sun.misc.Service.parseLine(Unknown Source)

at sun.misc.Service.parse(Unknown Source)

at sun.misc.Service.access$100(Unknown Source)

at sun.misc.Service$LazyIterator.hasNext(Unknown Source)

at
javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(Unknown
Source)

at javax.imageio.spi.IIORegistry.<init>(Unknown Source)

at javax.imageio.spi.IIORegistry.getDefaultInstance(Unknown Source)

at javax.imageio.ImageIO.<clinit>(Unknown Source)

at src.AppFTP.write(AppFTP.java:200)




The code is as below:

code:


//this is the original call, local file is a buffered image
byte[] buff = toByteArray(localFile, 0);

//this is the method
public static byte[] toByteArray(BufferedImage image, float quality) {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream(50000);
//this write method call is causing the error
write(image, quality, out);
return out.toByteArray();
} catch(IOException e) {
throw new RuntimeException(e);
}
}

//this is the line in the write method causing the error
public static void write(BufferedImage image, float quality, OutputStream
out) throws IOException {
Iterator writers = ImageIO.getImageWritersBySuffix("jpeg");
.....



Thanks for taking the time to read, not too sure if this should go here or
in applets.

The question really is can ImageIO be used in an applet or is there another
type of I/O stream that I could use that would be functional.

cheers
Martin

--

------------------------------------
Martin Thorpe
Web Developer
Non Stop Loop
www.nonstoploop.net
------------------------------------
 
R

Rhino

news.skynet.be said:
Hello I have written an application and used a code example to write a
buffered image to an image to a byteArrayOutput stream.

The error that I get is a
sun.misc.serviceConfigurationError.javax.imageit.spiImageOutputStream.

Really I don't understand this error!?!? what is this telling me is the main
question.
Sun itself advises you not to use the sun.* classes:

http://java.sun.com/products/jdk/faq/faq-sun-packages.html
Thanks for taking the time to read, not too sure if this should go here or
in applets.

There is no applets newsgroup, at least not in the comp.lang.java.* tree of
newsgroups. Perhaps you mean comp.lang.java.gui?
The question really is can ImageIO be used in an applet or is there another
type of I/O stream that I could use that would be functional.

I don't understand your question. Are you asking if an applet can display a
jpg? If so, the answer is yes.

If you can explain what you're actually trying to accomplish, we might be
able to suggest some ways of doing it.


Rhino
 
I

Ian Shef

Sun itself advises you not to use the sun.* classes:
"mart" did not use the sun.* classes. "mart" used javax.imageio.ImageIO,
which uses things that use the sun.* classes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top