public static void writeXid(ByteBuf buf, Xid xid) {
      if (xid instanceof RemoteXid) {
         ((RemoteXid) xid).writeTo(buf);
      } else {
         ByteBufUtil.writeSignedVInt(buf, xid.getFormatId());
         writeArray(buf, xid.getGlobalTransactionId());
         writeArray(buf, xid.getBranchQualifier());
      }
   }
public static void writeXid ( ByteBuf buf , Xid xid ) { if ( xid instanceof RemoteXid ) { ( ( RemoteXid ) xid ) . writeTo ( buf ) ; } else { ByteBufUtil . writeSignedVInt ( buf , xid . getFormatId ( ) ) ; writeArray ( buf , xid . getGlobalTransactionId ( ) ) ; writeArray ( buf , xid . getBranchQualifier ( ) ) ; } }
Writes the {@link Xid} to the {@link ByteBuf}.

@param buf the buffer to write to.
@param xid the {@link Xid} to encode