code: public void write_tuple_head(final int arity) {
          if (arity < 0xff) {
              write1(OtpExternal.smallTupleTag);
              write1(arity);
          } else {
              write1(OtpExternal.largeTupleTag);
              write4BE(arity);
          }
      }
docs: Write an Erlang tuple header to the stream. After calling this method,
  you must write 'arity' elements to the stream or it will not be possible
  to decode it later.
  
  @param arity
  the number of elements in the tuple.