save method

void save()

Implementation

void save() {
  var vendor = 'taglib_dart'.codeUnits;
  var vendorLength = vendor.length;
  var vendorLengthBytes = List<int>.filled(4, 0);
  vendorLengthBytes[3] = vendorLength >> 24;
  vendorLength %= 0x1000000;
  vendorLengthBytes[2] = vendorLength >> 16;
  vendorLength %= 0x10000;
  vendorLengthBytes[1] = vendorLength >> 8;
  vendorLength %= 0x100;
  vendorLengthBytes[0] = vendorLength;
  var commentsCount = _comments.length;
  var commentsCountBytes = List<int>.filled(4, 0);
  commentsCountBytes[3] = commentsCount >> 24;
  commentsCount %= 0x1000000;
  commentsCountBytes[2] = commentsCount >> 16;
  commentsCount %= 0x10000;
  commentsCountBytes[1] = commentsCount >> 8;
  commentsCount %= 0x100;
  commentsCountBytes[0] = commentsCount;
  List<int> commentsData = [];
  for (var comment in _comments) {
    var commentSize =
        comment.name.codeUnits.length +
        '='.codeUnits.length +
        comment.data.length;
    var commentSizeBytes = List<int>.filled(4, 0);
    commentSizeBytes[3] = commentSize >> 24;
    commentSize %= 0x1000000;
    commentSizeBytes[2] = commentSize >> 16;
    commentSize %= 0x10000;
    commentSizeBytes[1] = commentSize >> 8;
    commentSize %= 0x100;
    commentSizeBytes[0] = commentSize;
    commentsData +=
        commentSizeBytes +
        comment.name.codeUnits +
        '='.codeUnits +
        comment.data;
  }
  _flacMetaBlock.data =
      vendorLengthBytes + vendor + commentsCountBytes + commentsData;
}