/[classpath]/classpath/gnu/java/awt/image/ImageDecoder.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/image/ImageDecoder.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by mkoch, Tue Nov 4 11:24:07 2003 UTC revision 1.9 by fitzsim, Tue Dec 2 19:42:09 2003 UTC
# Line 48  public abstract class ImageDecoder imple Line 48  public abstract class ImageDecoder imple
48    Vector consumers = new Vector ();    Vector consumers = new Vector ();
49    String filename;    String filename;
50    URL url;    URL url;
51      byte[] data;
52      int offset;
53      int length;
54      InputStream input;
55    
56    public static ColorModel cm;    public static ColorModel cm;
57    
# Line 69  public abstract class ImageDecoder imple Line 73  public abstract class ImageDecoder imple
73      this.url = url;      this.url = url;
74    }    }
75    
76      public ImageDecoder (byte[] imagedata, int imageoffset, int imagelength)
77      {
78        data = imagedata;
79        offset = imageoffset;
80        length = imagelength;
81      }
82    
83    public void addConsumer (ImageConsumer ic)    public void addConsumer (ImageConsumer ic)
84    {    {
85      consumers.addElement (ic);      consumers.addElement (ic);
# Line 90  public abstract class ImageDecoder imple Line 101  public abstract class ImageDecoder imple
101      Vector list = (Vector) consumers.clone ();      Vector list = (Vector) consumers.clone ();
102      try      try
103        {        {
104          FileInputStream is = (url == null) ? new FileInputStream (filename) :          // Create the input stream here rather than in the
105                                            (FileInputStream) url.openStream();          // ImageDecoder constructors so that exceptions cause
106                                                              // imageComplete to be called with an appropriate error
107          produce (list, is);          // status.
108        }          if (url != null)
109              input = url.openStream();
110            else
111              {
112                if (filename != null)
113                  input = new FileInputStream (filename);
114                else
115                  input = new ByteArrayInputStream (data, offset, length);
116              }
117    
118            produce (list, input);
119          }
120      catch (Exception e)      catch (Exception e)
121        {        {
122          for (int i = 0; i < list.size (); i++)          for (int i = 0; i < list.size (); i++)
# Line 109  public abstract class ImageDecoder imple Line 131  public abstract class ImageDecoder imple
131    {    {
132    }    }
133    
134    public abstract void produce (Vector v, FileInputStream is) throws IOException;    public abstract void produce (Vector v, InputStream is) throws IOException;
135  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26