home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.image;
-
- import java.io.BufferedInputStream;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.InputStream;
-
- public class FileImageSource extends InputStreamImageSource {
- String imagefile;
-
- public FileImageSource(String filename) {
- System.getSecurityManager().checkRead(filename);
- this.imagefile = filename;
- }
-
- final boolean checkSecurity(Object context, boolean quiet) {
- return true;
- }
-
- protected ImageDecoder getDecoder() {
- InputStream is;
- try {
- is = new BufferedInputStream(new FileInputStream(this.imagefile));
- } catch (FileNotFoundException var4) {
- return null;
- }
-
- int suffixpos = this.imagefile.lastIndexOf(46);
- if (suffixpos >= 0) {
- String suffix = this.imagefile.substring(suffixpos + 1).toLowerCase();
- if (suffix.equals("gif")) {
- return new GifImageDecoder(this, is);
- }
-
- if (suffix.equals("jpeg") || suffix.equals("jpg") || suffix.equals("jpe") || suffix.equals("jfif")) {
- return new JPEGImageDecoder(this, is);
- }
-
- if (suffix.equals("xbm")) {
- return new XbmImageDecoder(this, is);
- }
- }
-
- return ((InputStreamImageSource)this).getDecoder(is);
- }
- }
-