/** * Skips variable length blocks up to and including * next zero length block. */ private void skip() { do { readBlock(); } while ((blockSize > 0) && !err()); } }
/** * Reads Netscape extenstion to obtain iteration count */ private void readNetscapeExt() { do { readBlock(); if (block[0] == 0x03) { // loop count sub-block int b1 = ((int) block[1]) & 0xff; int b2 = ((int) block[2]) & 0xff; loopCount = (b2 << 8) | b1; } } while ((blockSize > 0) && !err()); }
/** * Skips variable length blocks up to and including * next zero length block. */ private void skip() { do { readBlock(); } while ((blockSize > 0) && !err()); } }
/** * Reads Netscape extenstion to obtain iteration count */ private void readNetscapeExt() { do { readBlock(); if (block[0] == 0x03) { // loop count sub-block int b1 = ((int) block[1]) & 0xff; int b2 = ((int) block[2]) & 0xff; loopCount = (b2 << 8) | b1; } } while ((blockSize > 0) && !err()); }
/** * Reads GIF file header information. */ private void readHeader() { String id = ""; for (int i = 0; i < 6; i++) id += (char) read(); if (!id.startsWith("GIF")) { status = STATUS_FORMAT_ERROR; return; } readLSD(); if (gctFlag && !err()) { gct = readColorTable(gctSize); bgColor = gct[bgIndex]; } }
/** * Reads GIF file header information. */ private void readHeader() { String id = ""; for (int i = 0; i < 6; i++) id += (char) read(); if (!id.startsWith("GIF")) { status = STATUS_FORMAT_ERROR; return; } readLSD(); if (gctFlag && !err()) { gct = readColorTable(gctSize); bgColor = gct[bgIndex]; } }
/** * Reads GIF image from stream * * @param BufferedInputStream containing GIF file. * @return int read status code */ public int read(BufferedInputStream is) { init(); if (is != null) { in = is; readHeader(); if (!err()) { readContents(); if (frameCount < 0) status = STATUS_FORMAT_ERROR; } } else { status = STATUS_OPEN_ERROR; } try { is.close(); } catch (IOException e) {} return status; }
/** * Reads GIF image from stream * * @param BufferedInputStream containing GIF file. * @return int read status code */ public int read(BufferedInputStream is) { init(); if (is != null) { in = is; readHeader(); if (!err()) { readContents(); if (frameCount < 0) status = STATUS_FORMAT_ERROR; } } else { status = STATUS_OPEN_ERROR; } try { is.close(); } catch (IOException e) {} return status; }
while (!(done || err())) { int code = read(); switch (code) {
while (!(done || err())) { int code = read(); switch (code) {