Encode a system exclusive MIDI event

@private
@param {module:midijs/lib/file/event~SysexEvent} event Sysex event to encode
@return {Buffer} Encoded sysex event
343641
function encodeSysexEvent(event) {
    var cursor, length;

    length = encodeVarInt(event.data.length);
    cursor = new BufferCursor(new buffer.Buffer(
        1 + length.length + event.data.length
    ));

    cursor.writeUInt8(0xF0 | event.type);
    cursor.copy(length);
    cursor.copy(event.data);

    return cursor.buffer;
}
898101
def event(self, event):
        
        if (event.type() == QEvent.KeyPress) and (event.key() == Qt.Key_Tab):
            self.sig_tab_pressed.emit(True)
            self.numpress += 1
            if self.numpress == 1:
                self.presstimer = QTimer.singleShot(400, self.handle_keypress)
            return True
        return QComboBox.event(self, event)
1291299
function MouseEvent(eventType, params) {
    params = params || { bubbles: false, cancelable: false };
    var mouseEvent = document.createEvent('MouseEvent');
    mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

    return mouseEvent;
  }
45560
function encode(data) {
  var encodedData = null;
  try {
    encodedData = JSON.stringify(data);
  } catch (err) {
    logger.warn('failed encoding data', data);
  }
  return encodedData;
}
1306822
Rule MidiProgramNumber() {
		return FirstOf(
			CharRange('1', '9'),
			Sequence(CharRange('1', '9'), CharRange('0', '9')),
			Sequence('1', CharRange('0', '1'), CharRange('0', '9')),
			Sequence("12", CharRange('0', '8'))
		).label(MidiProgramNumber).suppressSubnodes();
	}
358887
function encode(fp) {
  return new Promise((resolve, reject) => {
    fp.encode((err, encoded) => {
      if (err) {
        reject(err);

        return;
      }
      resolve(encoded);
    });
  });
}
1285491
function(x) {
      var b = prng.getBytesSync(x.length);
      for(var i = 0; i < x.length; ++i) {
        x[i] = b.charCodeAt(i);
      }
    }
306349
function createKeyboardEvent(type, options) {
  options = clean(type, options);
  var e = document.createEvent('KeyboardEvent');
  (e.initKeyEvent || e.initKeyboardEvent).call(
    e,
    type,
    options.bubbles,
    options.cancelable,
    options.view,
    options.ctrl,
    options.alt,
    options.shift,
    options.meta,
    options.key,
    options.key
  );

  // http://stackoverflow.com/a/10520017
  if (e.keyCode !== options.key) {
    Object.defineProperty(e, 'keyCode', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'charCode', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'which', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'shiftKey', {
      get: function() { return options.shift; }
    });
  }

  return e;
}
876697
function encode(events) {
  if(!Array.isArray(events)) {
    return '00';
  }
  let bitmask = 0;
  for(event in events) {
    let index = events[event];
    bitmask += (1 << index);
  }
  return ('00' + bitmask.toString(16)).substr(-2);
}
8560
function encodeStringBuffer( encoder, str, utf8 ) {

	// If we do not have an explicit utf8 or not decision, pick one now
	if (utf8 === undefined) {
		utf8 = false; // Assume false
		for (var i=0, strLen=str.length; i<strLen; ++i) {
			if (str.charCodeAt(i) > 255) {
				utf8 = true; break;
			}
		}
	}

	// Allocate buffer
	var buf, bufView, bufType;
	if (utf8) {
		buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
		bufView = new Uint16Array(buf);
		bufType = PRIM_BUFFER_TYPE.STRING_UTF8;
		encoder.log(LOG.STR,"string='"+str+"', encoding=utf-8, len="+str.length);
	} else {
		buf = new ArrayBuffer(str.length); // 1 byte for each char
		bufView = new Uint8Array(buf);
		bufType = PRIM_BUFFER_TYPE.STRING_LATIN;
		encoder.log(LOG.STR,"string='"+str+"', encoding=latin, len="+str.length);
	}

	// Copy into buffer
	for (var i=0, strLen=str.length; i<strLen; ++i) {
		bufView[i] = str.charCodeAt(i);
	}

	// Write down
	encodeBuffer( encoder, bufType, null, bufView );

}
1287300
function MIDINotMIDIError() {
    Error.call(this);
    Error.captureStackTrace(this, this.constructor);

    this.name = this.constructor.name;
    this.message = 'Not a valid MIDI file';
}
1162145
public static String encode(List<XMLEvent> theEvents) {
		try {
			StringWriter w = new StringWriter();
			XMLEventWriter ew = XmlUtil.createXmlFragmentWriter(w);

			for (XMLEvent next : theEvents) {
				if (next.isCharacters()) {
					ew.add(next);
				} else {
					ew.add(next);
				}
			}
			ew.close();
			return w.toString();
		} catch (XMLStreamException e) {
			throw new DataFormatException("Problem with the contained XML events", e);
		} catch (FactoryConfigurationError e) {
			throw new ConfigurationException(e);
		}
	}
1362176
static void decodeTo(String eventKey, Collection<String> eventIds) {
        int startIdx = 0;
        String prevId = null;
        for (int i = 0; i < eventKey.length(); i++) {
            char ch = eventKey.charAt(i);
            if (ch == DELIM_REGULAR || ch == DELIM_SHARED_PREFIX) {
                String eventId = checkValid(combine(prevId, eventKey.substring(startIdx, i)));
                eventIds.add(eventId);
                prevId = (ch == DELIM_REGULAR) ? null : eventId;
                startIdx = i + 1;
            }
        }
        // Add the final event ID
        eventIds.add(checkValid(combine(prevId, eventKey.substring(startIdx, eventKey.length()))));
    }
1136061
function normalizeEvent(event) {
		var source = event.source || {};
		var ignoreTimezone = firstDefined(source.ignoreTimezone, options.ignoreTimezone);
		event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + '');
		if (event.date) {
			if (!event.start) {
				event.start = event.date;
			}
			delete event.date;
		}
		event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone));
		event.end = parseDate(event.end, ignoreTimezone);
		if (event.end && event.end <= event.start) {
			event.end = null;
		}
		event._end = event.end ? cloneDate(event.end) : null;
		if (event.allDay === undefined) {
			event.allDay = firstDefined(source.allDayDefault, options.allDayDefault);
		}
		if (event.className) {
			if (typeof event.className == 'string') {
				event.className = event.className.split(/\s+/);
			}
		}else{
			event.className = [];
		}
		// TODO: if there is no start date, return false to indicate an invalid event
	}
856827
function(data) {
      return proto.encodeStrict(data.a, data.b, data.c, data.d);
    }
569009
function encodeArray(array, proto, offset, buffer, protos){
    let i = 0;

    if(util.isSimpleType(proto.type)){
      offset = writeBytes(buffer, offset, encodeTag(proto.type, proto.tag));
      offset = writeBytes(buffer, offset, codec.encodeUInt32(array.length));
      for(i = 0; i < array.length; i++){
        offset = encodeProp(array[i], proto.type, offset, buffer);
      }
    }else{
      for(i = 0; i < array.length; i++){
        offset = writeBytes(buffer, offset, encodeTag(proto.type, proto.tag));
        offset = encodeProp(array[i], proto.type, offset, buffer, protos);
      }
    }

    return offset;
  }
974115
static String encode(List<String> eventIds) {
        checkArgument(!eventIds.isEmpty(), "Empty event ID list.");
        if (eventIds.size() == 1) {
            return checkValid(eventIds.get(0));
        }
        // Concatenate the event IDs using a simple scheme that efficiently encodes events that are the same length and
        // share a common prefix.
        StringBuilder buf = new StringBuilder();
        String prevId = null;
        for (String eventId : eventIds) {
            checkValid(eventId);
            int commonPrefixLength;
            if (prevId == null) {
                // First event ID
                buf.append(eventId);
            } else if (prevId.length() == eventId.length() &&
                    (commonPrefixLength = getCommonPrefixLength(prevId, eventId)) > 0) {
                // Event ID is same length and shares a common prefix with the previous.  Just add the part that's different.
                buf.append(DELIM_SHARED_PREFIX).append(eventId.substring(commonPrefixLength));
            } else {
                buf.append(DELIM_REGULAR).append(eventId);
            }
            prevId = eventId;
        }
        return buf.toString();
    }