OutputStream for encoder

Hi all, I found a small library for creating animated gifs but I don't understand how to use the last line of code (which requires an OutputStream)

publicclass Test{

publicstaticvoid main(String args[]){

ImageIcon icon;

//frames to animate

String paths[] ={

"frames/01.gif","frames/02.gif","frames/03.gif",

"frames/04.gif","frames/05.gif","frames/06.gif",

"frames/07.gif","frames/08.gif","frames/09.gif",

"frames/10.gif","frames/11.gif","frames/12.gif",

"frames/13.gif","frames/14.gif"

};

Image images[] =new Image[paths.length];

for(int i=0;i< paths.length;i++){

icon =new ImageIcon(paths[i]);

images[i] = icon.getImage();

}

Gif89Encoder gifenc =new Gif89Encoder();

for(int i=0;i< paths.length;i++)

gifenc.addFrame(images[i]);

gifenc.setComments("Test");

gifenc.setLoopCount(0);

gifenc.setUniformDelay(250);

gifenc.encode( );

}

}

That last method (encode) takes an OutputStream but I am not sure how to use one and save the image to disk. Do I need to use an OutputStream and then write it with ImageIO.write ? Any help would be appreciated.

Message was edited by:

emar82

Message was edited by:

emar82

[2337 byte] By [emar82a] at [2007-11-27 9:41:56]
# 1
FileOutputStream fos = new FileOutputStream(new File("myfile.gif"));This will give you an output stream that the library you are using will write to.Remeber to close
matfuda at 2007-7-12 23:44:22 > top of Java-index,Java Essentials,Java Programming...
# 2
Thanks a million, it generated perfectly! Thanks again!
emar82a at 2007-7-12 23:44:22 > top of Java-index,Java Essentials,Java Programming...