Here you can find the source of buildURLString(Iterable
Parameter | Description |
---|---|
elements | a parameter |
joiner | a parameter |
@Deprecated public static String buildURLString(Iterable<String> elements, String joiner)
//package com.java2s; /*/* w w w .j ava2 s . com*/ * Copyright (c) 2007-2012 The Broad Institute, Inc. * SOFTWARE COPYRIGHT NOTICE * This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved. * * This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality. * * This software is licensed under the terms of the GNU Lesser General Public License (LGPL), * Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php. */ import java.io.*; import java.net.*; import java.util.*; public class Main { /** * @param elements * @param joiner * @return * @deprecated HttpUtils.openConnection does URL encoding itself * <p/> * Join the {@code elements} with the character {@code joiner}, * URLencoding the {@code elements} along the way. {@code joiner} * is NOT URLEncoded * Example: * String[] parm_list = new String[]{"app les", "oranges", "bananas"}; * String formatted = buildURLString(Arrays.asList(parm_list), "+"); * <p/> * formatted will be "app%20les+oranges+bananas" */ @Deprecated public static String buildURLString(Iterable<String> elements, String joiner) { Iterator<String> iter = elements.iterator(); if (!iter.hasNext()) { return ""; } String wholequery = iter.next(); try { while (iter.hasNext()) { wholequery += joiner + URLEncoder.encode(iter.next(), "UTF-8"); } return wholequery; } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Bad argument in genelist: " + e.getMessage()); } } }