< prev index next >

src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java

Print this page




  97                 off += n;
  98                 len -= n;
  99             } catch (IOException e) {
 100                 break;
 101             }
 102         }
 103         return len;
 104     }
 105 
 106     private static final int ExtractByte(byte buf[], int off) {
 107         return (buf[off] & 0xFF);
 108     }
 109 
 110     private static final int ExtractWord(byte buf[], int off) {
 111         return (buf[off] & 0xFF) | ((buf[off + 1] & 0xFF) << 8);
 112     }
 113 
 114     /**
 115      * produce an image from the stream.
 116      */
 117     @SuppressWarnings("fallthrough")
 118     public void produceImage() throws IOException, ImageFormatException {
 119         try {
 120             readHeader();
 121 
 122             int totalframes = 0;
 123             int frameno = 0;
 124             int nloops = -1;
 125             int disposal_method = 0;
 126             int delay = -1;
 127             boolean loopsRead = false;
 128             boolean isAnimation = false;
 129 
 130             while (!aborted) {
 131                 int code;
 132 
 133                 switch (code = input.read()) {
 134                   case EXBLOCK:
 135                     switch (code = input.read()) {
 136                       case EX_GRAPHICS_CONTROL: {
 137                         byte buf[] = new byte[6];




  97                 off += n;
  98                 len -= n;
  99             } catch (IOException e) {
 100                 break;
 101             }
 102         }
 103         return len;
 104     }
 105 
 106     private static final int ExtractByte(byte buf[], int off) {
 107         return (buf[off] & 0xFF);
 108     }
 109 
 110     private static final int ExtractWord(byte buf[], int off) {
 111         return (buf[off] & 0xFF) | ((buf[off + 1] & 0xFF) << 8);
 112     }
 113 
 114     /**
 115      * produce an image from the stream.
 116      */
 117     @SuppressWarnings({"fallthrough", "deprecation"})
 118     public void produceImage() throws IOException, ImageFormatException {
 119         try {
 120             readHeader();
 121 
 122             int totalframes = 0;
 123             int frameno = 0;
 124             int nloops = -1;
 125             int disposal_method = 0;
 126             int delay = -1;
 127             boolean loopsRead = false;
 128             boolean isAnimation = false;
 129 
 130             while (!aborted) {
 131                 int code;
 132 
 133                 switch (code = input.read()) {
 134                   case EXBLOCK:
 135                     switch (code = input.read()) {
 136                       case EX_GRAPHICS_CONTROL: {
 137                         byte buf[] = new byte[6];


< prev index next >