code: private void writePrimitiveByteArray(byte[] bytes) {
          writeAMF3();
          this.buf.put(AMF3.TYPE_BYTEARRAY);
  
          if (hasReference(bytes)) {
              putInteger(getReferenceId(bytes) << 1);
              return;
          }
          storeReference(bytes);
          
          int length = bytes.length;
          putInteger(length << 1 | 0x1);
  
          this.buf.put(bytes);
      }
docs: Use the specialized BYTEARRAY type.