Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/apache/axis/components/image/JimiIO.java


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;
23  import java.io.OutputStream;
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 id, Image image, OutputStream os)
40              throws Exception {
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 in) throws Exception {
50          return Jimi.getImage(in);
51      }
52  }
53