Converts rdata to a String
499826
String
rrToString() {
	StringBuffer sb = new StringBuffer();
	sb.append(footprint);
	sb.append(" ");
	sb.append(alg);
	sb.append(" ");
	sb.append(digestid);
	if (digest != null) {
		sb.append(" ");
		sb.append(base16.toString(digest));
	}

	return sb.toString();
}
135404
def _get_params(self, rdata):
        
        if 'params' in rdata:
            if isinstance(rdata['params'], dict) \
                    or isinstance(rdata['params'], list) \
                    or rdata['params'] is None:
                return rdata['params']
            else:
                # wrong type
                raise InvalidRequestError
        else:
            return None
926527
public String getRawDataAsString() throws IOException
    {
        byte[] buffer = getRawData();
        if ( buffer == null ) {
            return null;
        }
        
        String encoding = request.getCharacterEncoding();
        if ( encoding == null ) {
            encoding = "utf-8";
        }
        
        return new String(buffer, encoding);
    }
343820
def to_s
      string =  "Execution ID:      #{@id}\n"
      string << "Name:              #{@name}\n"
      string << "Workflow ID:       #{@workflow_id}\n"
      string << "State:             #{@state}\n"
      string << "Start Date:        #{Time.at(@start_date / 1000)}\n"
      string << "End Date:          #{end_date.nil? ? '' : Time.at(@end_date / 1000)}\n"
      string << "Started By:        #{@started_by}\n"
      string << "Content Exception: #{@content_exception}\n" unless @content_exception.nil?
      string << "\nInput Parameters:\n"
      @input_parameters.each_value { |wf_param| string << " #{wf_param}" if wf_param.set? } if @input_parameters.size > 0
      string << "\nOutput Parameters:" << "\n"
      @output_parameters.each_value { |wf_param| string << " #{wf_param}" } if @output_parameters.size > 0
      string
    end
411598
def _ToString(x):
    """"""
    # Some cross-language values for primitives.  This is tested in
    # jsontemplate_test.py.
    if x is None:
        return 'null'
    if isinstance(x, six.string_types):
        return x
    return pprint.pformat(x)
1208568
public static String rowToString(JSONArray ja) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < ja.length(); i += 1) {
      if (i > 0) {
        sb.append(',');
      }
      Object o = ja.opt(i);
      if (o != null) {
        String s = o.toString();
        if (s.length() > 0 && (s.indexOf(',') >= 0 || s.indexOf('\n') >= 0 || s.indexOf('\r') >= 0 || s.indexOf(0) >= 0 || s.charAt(0) == '"')) {
          sb.append('"');
          int length = s.length();
          for (int j = 0; j < length; j += 1) {
            char c = s.charAt(j);
            if (c >= ' ' && c != '"') {
              sb.append(c);
            }
          }
          sb.append('"');
        } else {
          sb.append(s);
        }
      }
    }
    sb.append('\n');
    return sb.toString();
  }
630845
def _to_string(val):
    """"""
    if isinstance(val, binary_type):
        return val.decode('utf-8')
    assert isinstance(val, text_type)
    return val
166482
String
rrToString() {
	StringBuffer sb = new StringBuffer();
	sb.append(certificateUsage);
	sb.append(" ");
	sb.append(selector);
	sb.append(" ");
	sb.append(matchingType);
	sb.append(" ");
	sb.append(base16.toString(certificateAssociationData));

	return sb.toString();
}
1001114
String
rrToString() {
	StringBuffer sb = new StringBuffer();
	sb.append(hashAlg);
	sb.append(' ');
	sb.append(flags);
	sb.append(' ');
	sb.append(iterations);
	sb.append(' ');
	if (salt == null)
		sb.append('-');
	else
		sb.append(base16.toString(salt));
	sb.append(' ');
	sb.append(b32.toString(next));

	if (!types.empty()) {
		sb.append(' ');
		sb.append(types.toString());
	}

	return sb.toString();
}
280277
private static function outputApl(APL $rdata, int $padding): string
    {
        $blocks = explode(' ', $rdata->output());
        $longestVarLength = max(array_map('strlen', $blocks));
        $string = self::MULTILINE_BEGIN.PHP_EOL;

        foreach ($blocks as $block) {
            $string .= self::makeLine($block, null, $longestVarLength, $padding);
        }

        return $string.str_repeat(' ', $padding).self::MULTILINE_END;
    }
582171
protected String getParameterString(Collection<?> data) {

        StringBuffer conditions = new StringBuffer();
        conditions.append(BEGIN_CONDITION);
        Iterator<?> it = data.iterator();
        while (it.hasNext()) {
            it.next();
            conditions.append("?");
            if (it.hasNext()) {
                conditions.append(", ");
            }
        }
        conditions.append(END_CONDITION);
        return conditions.toString();
    }
417244
def paula_etree_to_string(tree, dtd_filename):
    """"""
    return etree.tostring(
        tree, pretty_print=True, xml_declaration=True,
        encoding="UTF-8", standalone='no',
        doctype='<!DOCTYPE paula SYSTEM "{0}">'.format(dtd_filename))
77303
def tostring(node, indent=4, nsmap=None):
    
    out = io.BytesIO()
    writer = StreamingXMLWriter(out, indent, nsmap=nsmap)
    writer.serialize(node)
    return out.getvalue()
270364
private String createSMMAStr(int smid, HashMap trData) {

        StringBuilder sb = new StringBuilder();
        String nitro = "Y";
        String water = "Y";
        String co2 = "M";
        String harOpt = "M";
        String sdate;
        String sm = String.format("%2d", smid);
//        ArrayList<HashMap> dataArr;
        HashMap subData;
        String vbose="N";

//        // Check if the meta data of fertilizer is not "N" ("Y" or null)
//        if (!getValueOr(expData, "fertilizer", "").equals("N")) {
//
//            // Check if necessary data is missing in all the event records
//            // P.S. rule changed since all the necessary data has a default value for it
//            dataArr = getObjectOr(trData, "fertilizer", new ArrayList());
//            if (dataArr.isEmpty()) {
//                nitro = "N";
//            }
////            for (int i = 0; i < dataArr.size(); i++) {
////                subData = dataArr.get(i);
////                if (getValueOr(subData, "date", "").equals("")
////                        || getValueOr(subData, "fecd", "").equals("")
////                        || getValueOr(subData, "feacd", "").equals("")
////                        || getValueOr(subData, "feamn", "").equals("")) {
////                    nitro = "N";
////                    break;
////                }
////            }
//        }
//        // Check if the meta data of irrigation is not "N" ("Y" or null)
//        if (!getValueOr(expData, "irrigation", "").equals("N")) {
//
//            // Check if necessary data is missing in all the event records
//            dataArr = getObjectOr(trData, "irrigation", new ArrayList());
//            for (int i = 0; i < dataArr.size(); i++) {
//                subData = dataArr.get(i);
//                if (getValueOr(subData, "date", "").equals("")
//                        || getValueOr(subData, "irval", "").equals("")) {
//                    water = "N";
//                    break;
//                }
//            }
//        }
        // Check if CO2Y value is provided and the value is positive, then set CO2 switch to W
        String co2y = getValueOr(trData, "co2y", "").trim();
        if (!co2y.equals("") && !co2y.startsWith("-")) {
            co2 = "W";
        }

        sdate = getValueOr(trData, "sdat", "");
        if (sdate.equals("")) {
            subData = getObjectOr(trData, "planting", new HashMap());
            sdate = getValueOr(subData, "date", defValD);
        }
        sdate = formatDateStr(sdate);
        sdate = String.format("%5s", sdate);

        if (!getValueOr(trData, "hadat_valid", "").trim().equals("")) {
            harOpt = "R";
        }
        
        if (getValueOr(trData, "seasonal_dome_applied", "").trim().equals("Y")) {
            vbose = "0";
        }

        String smStr;
        HashMap smData;
        // GENERAL
        sb.append("@N GENERAL     NYERS NREPS START SDATE RSEED SNAME.................... SMODEL\r\n");
        if (!(smStr = getValueOr(trData, "sm_general", "")).equals("")) {
            if (!sdate.trim().equals("-99") && !sdate.trim().equals("")) {
                smStr = replaceSMStr(smStr, sdate, 30);
            }
            smStr = replaceSMStr(smStr, getValueOr(trData, "dssat_model", ""), 68);
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "general", new HashMap())).isEmpty()) {
            if (sdate.trim().equals("-99") || sdate.trim().equals("")) {
                sdate = String.format("%1$02d%2$03d", Integer.parseInt(formatNumStr(2, smData, "sdyer", "0").trim()), Integer.parseInt(formatNumStr(3, smData, "sdday", "0").trim()));
            }
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s     %5$-1s %6$5s %7$5s %8$-25s %9$s\r\n",
                    sm,
                    "GE",
                    getValueOr(smData, "nyers", "1"),
                    getValueOr(smData, "nreps", "1"),
                    getValueOr(smData, "start", "S"),
                    sdate,
                    getValueOr(smData, "rseed", "250"),
                    getValueOr(smData, "sname", defValC),
                    getValueOr(trData, "dssat_model", getValueOr(smData, "model", ""))));
        } else {
            sb.append(sm).append(" GE              1     1     S ").append(sdate).append("  2150 DEFAULT SIMULATION CONTRL ").append(getValueOr(trData, "dssat_model", "")).append("\r\n");
        }
        // OPTIONS
        sb.append("@N OPTIONS     WATER NITRO SYMBI PHOSP POTAS DISES  CHEM  TILL   CO2\r\n");
        if (!(smStr = getValueOr(trData, "sm_options", "")).equals("")) {
//            smStr = replaceSMStr(smStr, co2, 64);
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "options", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s\r\n",
                    sm,
                    "OP",
                    getValueOr(smData, "water", water),
                    getValueOr(smData, "nitro", nitro),
                    getValueOr(smData, "symbi", "Y"),
                    getValueOr(smData, "phosp", "N"),
                    getValueOr(smData, "potas", "N"),
                    getValueOr(smData, "dises", "N"),
                    getValueOr(smData, "chem", "N"),
                    getValueOr(smData, "till", "Y"),
                    getValueOr(smData, "co2", co2)));
        } else {
            sb.append(sm).append(" OP              ").append(water).append("     ").append(nitro).append("     Y     N     N     N     N     Y     ").append(co2).append("\r\n");
        }
        // METHODS
        sb.append("@N METHODS     WTHER INCON LIGHT EVAPO INFIL PHOTO HYDRO NSWIT MESOM MESEV MESOL\r\n");
        if (!(smStr = getValueOr(trData, "sm_methods", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "methods", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s     %12$-1s     %13$-1s\r\n",
                    sm,
                    "ME",
                    getValueOr(smData, "wther", "M"),
                    getValueOr(smData, "incon", "M"),
                    getValueOr(smData, "light", "E"),
                    getValueOr(smData, "evapo", "R"),
                    getValueOr(smData, "infil", "S"),
                    getValueOr(smData, "photo", "L"),
                    getValueOr(smData, "hydro", "R"),
                    getValueOr(smData, "nswit", "1"),
                    getValueOr(smData, "mesom", "P"),
                    getValueOr(smData, "mesev", "S"),
                    getValueOr(smData, "mesol", "2")));
        } else {
            sb.append(sm).append(" ME              M     M     E     R     S     L     R     1     P     S     2\r\n"); // P.S. 2012/09/02 MESOM "G" -> "P"
        }
        // MANAGEMENT
        sb.append("@N MANAGEMENT  PLANT IRRIG FERTI RESID HARVS\r\n");
        if (!(smStr = getValueOr(trData, "sm_management", "")).equals("")) {
//            smStr = smStr.replaceAll("     D", "     R");
//            smStr = replaceSMStr(smStr, harOpt, 40);
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "management", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s\r\n",
                    sm,
                    "MA",
                    getValueOr(smData, "plant", "R"),
                    getValueOr(smData, "irrig", "R"),
                    getValueOr(smData, "ferti", "R"),
                    getValueOr(smData, "resid", "R"),
                    getValueOr(smData, "harvs", harOpt)));
        } else {
            sb.append(sm).append(" MA              R     R     R     R     ").append(harOpt).append("\r\n");
        }
        // OUTPUTS
        sb.append("@N OUTPUTS     FNAME OVVEW SUMRY FROPT GROUT CAOUT WAOUT NIOUT MIOUT DIOUT VBOSE CHOUT OPOUT\r\n");
        if (!(smStr = getValueOr(trData, "sm_outputs", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n\r\n");
        } else if (!(smData = getObjectOr(trData, "outputs", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s %6$5s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s     %12$-1s     %13$-1s     %14$-1s     %15$-1s\r\n\r\n",
                    sm,
                    "OU",
                    getValueOr(smData, "fname", "N"),
                    getValueOr(smData, "ovvew", "Y"),
                    getValueOr(smData, "sumry", "Y"),
                    getValueOr(smData, "fropt", "1"),
                    getValueOr(smData, "grout", "Y"),
                    getValueOr(smData, "caout", "Y"),
                    getValueOr(smData, "waout", "N"),
                    getValueOr(smData, "niout", "N"),
                    getValueOr(smData, "miout", "N"),
                    getValueOr(smData, "diout", "N"),
                    getValueOr(smData, "vbose", vbose),
                    getValueOr(smData, "chout", "N"),
                    getValueOr(smData, "opout", "N")));
        } else {
            sb.append(sm).append(" OU              N     Y     Y     1     Y     Y     N     N     N     N     ").append(vbose).append("     N     N\r\n\r\n");
        }
        // PLANTING
        sb.append("@  AUTOMATIC MANAGEMENT\r\n");
        sb.append("@N PLANTING    PFRST PLAST PH2OL PH2OU PH2OD PSTMX PSTMN\r\n");
        if (!(smStr = getValueOr(trData, "sm_planting", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "planting", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$02d%4$03d %5$02d%6$03d %7$5s %8$5s %9$5s %10$5s %11$5s\r\n",
                    sm,
                    "PL",
                    Integer.parseInt(formatNumStr(2, smData, "pfyer", "82")),
                    Integer.parseInt(formatNumStr(3, smData, "pfday", "050")),
                    Integer.parseInt(formatNumStr(2, smData, "plyer", "82")),
                    Integer.parseInt(formatNumStr(3, smData, "plday", "064")),
                    getValueOr(smData, "ph2ol", "40"),
                    getValueOr(smData, "ph2ou", "100"),
                    getValueOr(smData, "ph2od", "30"),
                    getValueOr(smData, "pstmx", "40"),
                    getValueOr(smData, "pstmn", "10")));
        } else {
            sb.append(sm).append(" PL          82050 82064    40   100    30    40    10\r\n");
        }
        // IRRIGATION
        sb.append("@N IRRIGATION  IMDEP ITHRL ITHRU IROFF IMETH IRAMT IREFF\r\n");
        if (!(smStr = getValueOr(trData, "sm_irrigation", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "irrigation", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s %6$-5s %7$-5s %8$5s %9$5s\r\n",
                    sm,
                    "IR",
                    getValueOr(smData, "imdep", "30"),
                    getValueOr(smData, "ithrl", "50"),
                    getValueOr(smData, "ithru", "100"),
                    getValueOr(smData, "iroff", "GS000"),
                    getValueOr(smData, "imeth", "IR001"),
                    getValueOr(smData, "iramt", "10"),
                    getValueOr(smData, "ireff", "1.00")));
        } else {
            sb.append(sm).append(" IR             30    50   100 GS000 IR001    10  1.00\r\n");
        }
        // NITROGEN
        sb.append("@N NITROGEN    NMDEP NMTHR NAMNT NCODE NAOFF\r\n");
        if (!(smStr = getValueOr(trData, "sm_nitrogen", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "nitrogen", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s %6$-5s %7$-5s\r\n",
                    sm,
                    "NI",
                    getValueOr(smData, "nmdep", "30"),
                    getValueOr(smData, "nmthr", "50"),
                    getValueOr(smData, "namnt", "25"),
                    getValueOr(smData, "ncode", "FE001"),
                    getValueOr(smData, "naoff", "GS000")));
        } else {
            sb.append(sm).append(" NI             30    50    25 FE001 GS000\r\n");
        }
        // RESIDUES
        sb.append("@N RESIDUES    RIPCN RTIME RIDEP\r\n");
        if (!(smStr = getValueOr(trData, "sm_residues", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "residues", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s\r\n",
                    sm,
                    "RE",
                    getValueOr(smData, "ripcn", "100"),
                    getValueOr(smData, "rtime", "1"),
                    getValueOr(smData, "ridep", "20")));
        } else {
            sb.append(sm).append(" RE            100     1    20\r\n");
        }
        // HARVEST
        sb.append("@N HARVEST     HFRST HLAST HPCNP HPCNR\r\n");
        if (!(smStr = getValueOr(trData, "sm_harvests", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n\r\n");
        } else if (!(smData = getObjectOr(trData, "harvests", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$02d%5$03d %6$5s %7$5s\r\n\r\n",
                    sm,
                    "HA",
                    getValueOr(smData, "hfrst", "0"),
                    Integer.parseInt(formatNumStr(2, smData, "hlyer", "83")),
                    Integer.parseInt(formatNumStr(3, smData, "hlday", "057")),
                    getValueOr(smData, "hpcnp", "100"),
                    getValueOr(smData, "hpcnr", "0")));
        } else {
            sb.append(sm).append(" HA              0 83057   100     0\r\n\r\n");
        }

        return sb.toString();
    }
981626
String
rrToString() {
	StringBuffer sb = new StringBuffer();
	if (options != null) {
		sb.append(options);
		sb.append(" ");
	}
	sb.append(" ; payload ");
	sb.append(getPayloadSize());
	sb.append(", xrcode ");
	sb.append(getExtendedRcode());
	sb.append(", version ");
	sb.append(getVersion());
	sb.append(", flags ");
	sb.append(getFlags());
	return sb.toString();
}
122633
String
rrToString() {
	InetAddress addr;
	try {
		addr = InetAddress.getByAddress(null, address);
	} catch (UnknownHostException e) {
		return null;
	}
	if (addr.getAddress().length == 4) {
		// Deal with Java's broken handling of mapped IPv4 addresses.
		StringBuffer sb = new StringBuffer("0:0:0:0:0:ffff:");
		int high = ((address[12] & 0xFF) << 8) + (address[13] & 0xFF);
		int low = ((address[14] & 0xFF) << 8) + (address[15] & 0xFF);
		sb.append(Integer.toHexString(high));
		sb.append(':');
		sb.append(Integer.toHexString(low));
		return sb.toString();
	}
	return addr.getHostAddress();
}
988656
def to_xml_string(str = '')
      str << '<?xml version="1.0" encoding="UTF-8"?>'
      str << ('<pivotTableDefinition xmlns="' << XML_NS << '" name="' << name << '" cacheId="' << cache_definition.cache_id.to_s << '"  dataOnRows="1" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="1" dataCaption="Data" showMultipleLabel="0" showMemberPropertyTips="0" useAutoFormatting="1" indent="0" compact="0" compactData="0" gridDropZones="1" multipleFieldFilters="0">')
      str << ('<location firstDataCol="1" firstDataRow="1" firstHeaderRow="1" ref="' << ref << '"/>')
      str << ('<pivotFields count="' << header_cells_count.to_s << '">')
      header_cell_values.each do |cell_value|
        str << pivot_field_for(cell_value, !no_subtotals_on_headers.include?(cell_value))
      end
      str << '</pivotFields>'
      if rows.empty?
        str << '<rowFields count="1"><field x="-2"/></rowFields>'
        str << '<rowItems count="2"><i><x/></i> <i i="1"><x v="1"/></i></rowItems>'
      else
        str << ('<rowFields count="' << rows.size.to_s << '">')
        rows.each do |row_value|
          str << ('<field x="' << header_index_of(row_value).to_s << '"/>')
        end
        str << '</rowFields>'
        str << ('<rowItems count="' << rows.size.to_s << '">')
        rows.size.times do |i|
          str << '<i/>'
        end
        str << '</rowItems>'
      end
      if columns.empty?
        str << '<colItems count="1"><i/></colItems>'
      else
        str << ('<colFields count="' << columns.size.to_s << '">')
        columns.each do |column_value|
          str << ('<field x="' << header_index_of(column_value).to_s << '"/>')
        end
        str << '</colFields>'
      end
      unless pages.empty?
        str << ('<pageFields count="' << pages.size.to_s << '">')
        pages.each do |page_value|
          str << ('<pageField fld="' << header_index_of(page_value).to_s << '"/>')
        end
        str << '</pageFields>'
      end
      unless data.empty?
        str << "<dataFields count=\"#{data.size}\">"
        data.each do |datum_value|
          # The correct name prefix in ["Sum","Average", etc...]
          str << "<dataField name='#{(datum_value[:subtotal]||'')} of #{datum_value[:ref]}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
          str << " subtotal='#{datum_value[:subtotal]}' " if datum_value[:subtotal]
          str << "/>"
        end
        str << '</dataFields>'
      end
      # custom pivot table style
      unless style_info.empty?
        str << '<pivotTableStyleInfo'
        style_info.each do |k,v|
          str << ' ' << k.to_s << '="' << v.to_s << '"'
        end
        str << ' />'
      end
      str << '</pivotTableDefinition>'
    end