Helper that creates a NDEF record containing a URI.

@uri String
@id byte[] (optional)
551286
function (uri, id) {
        var payload = uriHelper.encodePayload(uri);
        if (!id) { id = []; }
        return ndef.record(ndef.TNF_WELL_KNOWN, ndef.RTD_URI, id, payload);
    }
1216952
public static Uri createUri(Class<? extends Model> type, Long id) {
		final StringBuilder uri = new StringBuilder();
		uri.append("content://");
		uri.append(sAuthority);
		uri.append("/");
		uri.append(Ollie.getTableName(type).toLowerCase());

		if (id != null) {
			uri.append("/");
			uri.append(id.toString());
		}

		return Uri.parse(uri.toString());
	}
894329
@Nullable
    private Record getRecord(final URI layer, @Nullable final URI id) throws Throwable {
        final Record record = id == null ? null : getSession().retrieve(layer).ids(id).exec()
                .getUnique();
        if (record != null && layer.equals(KS.MENTION)) {
            final String template = "SELECT ?e WHERE { ?e $$ $$ "
                    + (getUIConfig().isDenotedByAllowsGraphs() ? ""
                            : "FILTER NOT EXISTS { GRAPH ?e { ?s ?p ?o } } ") + "}";
            for (final URI entityID : getSession()
                    .sparql(template, getUIConfig().getDenotedByProperty(), id).execTuples()
                    .transform(URI.class, true, "e")) {
                record.add(KS.REFERS_TO, entityID);
            }
        }
        return record;
    }
359621
@Override
    protected RequestEntity generateRequestEntity() {
        if (!this.params.isEmpty()) {
            // Use a ByteArrayRequestEntity instead of a StringRequestEntity.
            // This is to avoid potential encoding issues.  Form url encoded strings
            // are ASCII by definition but the content type may not be.  Treating the content
            // as bytes allows us to keep the current charset without worrying about how
            // this charset will effect the encoding of the form url encoded string.
            String content = EncodingUtil.formUrlEncode(getParameters(), getRequestCharSet());
            ByteArrayRequestEntity entity = new ByteArrayRequestEntity(
                EncodingUtil.getAsciiBytes(content),
                FORM_URL_ENCODED_CONTENT_TYPE
            );
            return entity;
        }
        return super.generateRequestEntity();
    }
130696
public URI build() {
    try {
      return new URI((isView ? VIEW_SCHEME : DATASET_SCHEME) + ":" +
          pattern.construct(options).toString());
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException("Could not build URI", e);
    }
  }
1253
@Override
    public URI toUri() {
        final URI root = ShrinkWrapFileSystems.getRootUri(this.fileSystem.getArchive());
        // Compose a new URI location, stripping out the extra "/" root
        final String location = root.toString() + this.toString().substring(1);
        final URI uri = URI.create(location);
        return uri;
    }
892458
public static Observable<File> createFileFromUri(final Context context, final Uri data) {
    return createFileFromUri(context, data, MimeMap.UrlConnection);
  }
1159095
private String encodeUri( String uri ) {
    String newUri = "";
    StringTokenizer st = new StringTokenizer( uri, "/ ", true );
    while ( st.hasMoreTokens()) {
      String tok = st.nextToken();
      if ( tok.equals( "/" ))
        newUri += "/";
      else if ( tok.equals( " " ))
        newUri += "%20";
      else {
        try {
          newUri += URLEncoder.encode( tok, "UTF-8" );
        } catch( UnsupportedEncodingException e ) {
          throw  Log.errRTExcept(e);
        }
      }
    }
    return newUri;
  }
1269349
protected function createWhenUri($uri)
    {
        $when = static::$firing['when'];

        if (substr($when, -1) !== '/') {
            $when .= '/';
        }

        if(substr($uri, 0,1) === '/'){
            $uri = substr($uri, 1, strlen($uri));
        }

        return $when.$uri;
    }
582870
public static String concatEntityCollectionHref(
      String baseUri,
      String qualifiedEntityName,
      String qualifiedIdAttributeName,
      List<String> entitiesIds) {
    String ids;
    ids = entitiesIds.stream().map(Href::encodeIdToRSQL).collect(Collectors.joining(","));
    return String.format(
        "%s/%s?q=%s=in=(%s)",
        baseUri,
        encodePathSegment(qualifiedEntityName),
        encodePathSegment(qualifiedIdAttributeName),
        ids);
  }
958187
protected URI createUri(String file,
      DatanodeID[] candidates,  UnixUserGroupInformation ugi,
      HttpServletRequest request) throws URISyntaxException {
    String scheme = request.getScheme();
    final DatanodeID host = candidates[0];
    final String hostname;
    if (host instanceof DatanodeInfo) {
      hostname = ((DatanodeInfo)host).getHostName();
    } else {
      hostname = host.getHost();
    }
    
    // Construct query.
    StringBuilder builder = new StringBuilder();
    builder.append("ugi=" + ugi);
    
    // Populate the rest of parameters.
    Enumeration<?> it = request.getParameterNames();
    while (it.hasMoreElements()) {
      String key = it.nextElement().toString();
      String value = request.getParameter(key);
      builder.append("&" + key + "=" + value);
    }

    // Construct the possible candidates for retry
    if (candidates.length > 1) {
      builder.append("&candidates=");
      appendDatanodeID(builder, candidates[1]);
      for (int j=2; j<candidates.length; j++) {
        builder.append(" ");
        appendDatanodeID(builder, candidates[j]);
      }
    }

    // Add namenode address to the url params
    NameNode nn = (NameNode)getServletContext().getAttribute("name.node");
    String addr = NetUtils.toIpPort(nn.getNameNodeAddress());
    builder.append(JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, addr));

    return new URI(scheme, null, hostname,
        "https".equals(scheme)
          ? (Integer)getServletContext().getAttribute("datanode.https.port")
          : host.getInfoPort(),
        "/streamFile" + file, builder.toString(), null);
  }
336158
private URI getBaseURI(URI configKey) throws URISyntaxException {
    return new URI(configKey.getScheme(), configKey.getAuthority(), null, configKey.getQuery(), configKey.getFragment());
  }
181002
private String encodeUri( String uri )
	{
		StringBuilder newUri = new StringBuilder();
		StringTokenizer st = new StringTokenizer( uri, "/ ", true );
		while ( st.hasMoreTokens())
		{
			String tok = st.nextToken();
			if ( tok.equals( "/" )) {
				newUri.append('/');
			} else if ( tok.equals( " " )) {
				newUri.append("%20");
			} else {
				try {
					newUri.append(URLEncoder.encode( tok, "UTF-8" ));
				} catch ( UnsupportedEncodingException uee ) { // NOPMD - imported code
					// imported code
				}
			}
		}
		return newUri.toString();
	}
658575
def genAddRecordForm( dbid, fvlist = nil )

      @dbid, @fvlist = dbid, fvlist
      setFieldValues( fvlist, false ) if fvlist.is_a?(Hash) 

      xmlRequestData = ""
      @fvlist.each { |fv| xmlRequestData << fv } if @fvlist #see addFieldValuePair, clearFieldValuePairList, @fvlist

      sendRequest( :genAddRecordForm, xmlRequestData )

      @HTML = @responseXML

      return self if @chainAPIcalls
      @HTML
   end
812802
final String debugId(long id) {
    byte[] buf = new byte[8];
    ArrayUtil.writeLong(buf, 0, id);
    return HexUtil.toString(buf);
  }
914191
public static function create($uri, $base_uri = null): UriInterface
    {
        if (!$uri instanceof UriInterface) {
            $uri = self::createFromString($uri);
        }

        if (null === $base_uri) {
            if (null === $uri->getScheme()) {
                throw new SyntaxError(sprintf('the URI `%s` must be absolute', (string) $uri));
            }

            if (null === $uri->getAuthority()) {
                return $uri;
            }

            return UriResolver::resolve($uri, $uri->withFragment(null)->withQuery(null)->withPath(''));
        }

        if (!$base_uri instanceof UriInterface) {
            $base_uri = self::createFromString($base_uri);
        }

        if (null === $base_uri->getScheme()) {
            throw new SyntaxError(sprintf('the base URI `%s` must be absolute', (string) $base_uri));
        }

        return UriResolver::resolve($uri, $base_uri);
    }
466438
private String sanitizeUri(String uri) {
        if (uri == null || uri.length() == 0) {
            return null;
        }
        try {
            return new URI(uri).toString();
        } catch (URISyntaxException e) {
            return null;
        }
    }