docs: def writeByteArray(self, n):
          """
          Writes a L{ByteArray} to the data stream.
  
          @param n: The L{ByteArray} data to be encoded to the AMF3 data stream.
          @type n: L{ByteArray}
          """
          self.stream.write(TYPE_BYTEARRAY)
  
          ref = self.context.getObjectReference(n)
  
          if ref != -1:
              self._writeInteger(ref << 1)
  
              return
  
          self.context.addObject(n)
  
          buf = str(n)
          l = len(buf)
          self._writeInteger(l << 1 | REFERENCE_BIT)
          self.stream.write(buf)