uncompressTable function

Map<String, dynamic> uncompressTable(
  1. dynamic data,
  2. Map<String, dynamic> tableEntry
)

@param {DataView} @param {Object} @return {TableData}

Implementation

Map<String, dynamic> uncompressTable(data, Map<String, dynamic> tableEntry) {
  if (tableEntry["compression"] == 'WOFF') {
      var inBuffer = new Uint8List.view(data.buffer, tableEntry["offset"] + 2, tableEntry["compressedLength"] - 2);
      var outBuffer = new Uint8List(tableEntry.length);
      // inflate(inBuffer, outBuffer);
      if (outBuffer.lengthInBytes != tableEntry.length) {
          throw('Decompression error: ' + tableEntry["tag"] + ' decompressed length doesn\'t match recorded length');
      }

      var view = DataView(outBuffer.buffer, 0);
      return {"data": view, "offset": 0};
  } else {
      return {"data": data, "offset": tableEntry["offset"]};
  }
}