writeByteArray(value) {
    const idx = this.objects.indexOf(value)

    if (idx >= 0) {
      return this.buffer.writeUInt29((idx << 1) | 0)
    }

    this.objects.push(value)

    // Copy the bytes into the buffer
    for (let i = 0; i < value.length; i++) {
      this.buffer.writeByte(value[i])
    }

    // Store the marker position
    this.byteBit[0] = this.buffer.writePosition

    this.buffer.writeByte(Markers.AMF3.BYTE_ARRAY)

    // Store the UINT29 position
    this.byteBit[1] = this.buffer.writePosition

    // + 1 because of the ByteArray marker
    this.buffer.writeUInt29(((value.length + 1) << 1) | 1)

    // Copy the bytes into the buffer again
    for (let i = 0; i < value.length; i++) {
      this.buffer.writeByte(value[i])
    }

    this.buffer.writeByte(Markers.AMF3.BYTE_ARRAY)
  }
/**
   * Writes an AMF3 ByteArray
   * @param {Buffer} value
   */
Writes an AMF3 ByteArray
@param {Buffer} value
Writes an AMF3 ByteArray @param { Buffer } value
writeByteArray(value) {
    const idx = this.objects.indexOf(value)
    if (idx >= 0) {
      return this.buffer.writeUInt29((idx << 1) | 0)
    }
    this.objects.push(value)
    for (let i = 0; i < value.length; i++) {
      this.buffer.writeByte(value[i])
    }
    this.byteBit[0] = this.buffer.writePosition
    this.buffer.writeByte(Markers.AMF3.BYTE_ARRAY)
    this.byteBit[1] = this.buffer.writePosition
    this.buffer.writeUInt29(((value.length + 1) << 1) | 1)
     again
    for (let i = 0; i < value.length; i++) {
      this.buffer.writeByte(value[i])
    }
    this.buffer.writeByte(Markers.AMF3.BYTE_ARRAY)
  }
writeByteArray ( value ) { const idx = this . objects . indexOf ( value ) if ( idx >= 0 ) { return this . buffer . writeUInt29 ( ( idx << 1 ) | 0 ) } this . objects . push ( value ) for ( let i = 0 ; i < value . length ; i ++ ) { this . buffer . writeByte ( value [ i ] ) } this . byteBit [ 0 ] = this . buffer . writePosition this . buffer . writeByte ( Markers . AMF3 . BYTE_ARRAY ) this . byteBit [ 1 ] = this . buffer . writePosition this . buffer . writeUInt29 ( ( ( value . length + 1 ) << 1 ) | 1 ) for ( let i = 0 ; i < value . length ; i ++ ) { this . buffer . writeByte ( value [ i ] ) } this . buffer . writeByte ( Markers . AMF3 . BYTE_ARRAY ) }
Writes an AMF3 ByteArray
 @param {Buffer} value
Writes an AMF3 ByteArray @param { Buffer } value
// Copy the bytes into the buffer // Store the marker position // Store the UINT29 position // + 1 because of the ByteArray marker // Copy the bytes into the buffer again