KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > components > image > JimiIO


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.axis.components.image;
18
19 import com.sun.jimi.core.Jimi;
20
21 import java.awt.*;
22 import java.io.InputStream JavaDoc;
23 import java.io.OutputStream JavaDoc;
24
25 /**
26  * JIMI based Image I/O
27  * @author <a HREF="mailto:dims@yahoo.com">Davanum Srinivas</a>
28  * @since 2.0
29  */

30 public class JimiIO implements ImageIO {
31     /**
32      * Save an image.
33      * @param id the mime-type of the format to save the image
34      * @param image the image to save
35      * @param filename the file to write to
36      * @exception JimiException if an error prevents image encoding
37      */

38
39     public void saveImage(String JavaDoc id, Image image, OutputStream JavaDoc os)
40             throws Exception JavaDoc {
41         Jimi.putImage(id, image, os);
42     }
43
44     /**
45      * Load an Image.
46      * @param in the stream to load the image
47      * @return the Image
48      */

49     public Image loadImage(InputStream JavaDoc in) throws Exception JavaDoc {
50         return Jimi.getImage(in);
51     }
52 }
53
54
Popular Tags