src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java

Print this page
rev 9343 : 8033716: Fix raw and unchecked lint warnings in com.sun.imageio
Reviewed-by: darcy, prr, bae


  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.imageio.spi;
  27 
  28 import java.io.File;
  29 import java.io.RandomAccessFile;
  30 import java.util.Locale;
  31 import javax.imageio.spi.ImageOutputStreamSpi;
  32 import javax.imageio.stream.ImageOutputStream;
  33 import javax.imageio.stream.FileImageOutputStream;
  34 
  35 public class RAFImageOutputStreamSpi extends ImageOutputStreamSpi {
  36 
  37     private static final String vendorName = "Oracle Corporation";
  38 
  39     private static final String version = "1.0";
  40 
  41     private static final Class outputClass = RandomAccessFile.class;
  42 
  43     public RAFImageOutputStreamSpi() {
  44         super(vendorName, version, outputClass);
  45     }
  46 
  47     public String getDescription(Locale locale) {
  48         return "Service provider that instantiates a FileImageOutputStream from a RandomAccessFile";
  49     }
  50 
  51     public ImageOutputStream createOutputStreamInstance(Object output,
  52                                                         boolean useCache,
  53                                                         File cacheDir) {
  54         if (output instanceof RandomAccessFile) {
  55             try {
  56                 return new FileImageOutputStream((RandomAccessFile)output);
  57             } catch (Exception e) {
  58                 e.printStackTrace();
  59                 return null;
  60             }
  61         } else {


  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.imageio.spi;
  27 
  28 import java.io.File;
  29 import java.io.RandomAccessFile;
  30 import java.util.Locale;
  31 import javax.imageio.spi.ImageOutputStreamSpi;
  32 import javax.imageio.stream.ImageOutputStream;
  33 import javax.imageio.stream.FileImageOutputStream;
  34 
  35 public class RAFImageOutputStreamSpi extends ImageOutputStreamSpi {
  36 
  37     private static final String vendorName = "Oracle Corporation";
  38 
  39     private static final String version = "1.0";
  40 
  41     private static final Class<?> outputClass = RandomAccessFile.class;
  42 
  43     public RAFImageOutputStreamSpi() {
  44         super(vendorName, version, outputClass);
  45     }
  46 
  47     public String getDescription(Locale locale) {
  48         return "Service provider that instantiates a FileImageOutputStream from a RandomAccessFile";
  49     }
  50 
  51     public ImageOutputStream createOutputStreamInstance(Object output,
  52                                                         boolean useCache,
  53                                                         File cacheDir) {
  54         if (output instanceof RandomAccessFile) {
  55             try {
  56                 return new FileImageOutputStream((RandomAccessFile)output);
  57             } catch (Exception e) {
  58                 e.printStackTrace();
  59                 return null;
  60             }
  61         } else {