readNext static method

Future<ZipHeader?> readNext(
  1. FileBuffer src,
  2. int signature
)

Implementation

static Future<ZipHeader?> readNext(FileBuffer src, int signature) async {
  if (src.isEnd) return null;

  ZipHeader r;
  if (signature == 0x0403) {
    // local file
    r = ZipLocalFile(signature);
  } else if (signature == 0x0201) {
    // central directory
    r = ZipCentralDirectory(signature);
  } else if (signature == 0x0605) {
    // end of central directory
    r = ZipEndCentralDirectory(signature);
  } else {
    return null;
  }

  r.offsetStart = src.position - 4;
  await r._read(src);
  r.offsetEnd = src.position;

  return r;
}