Udostępnij za pośrednictwem


URI.Normalize Method

Definition

Normalizes this URI's path.

[Android.Runtime.Register("normalize", "()Ljava/net/URI;", "")]
public Java.Net.URI? Normalize ();
[<Android.Runtime.Register("normalize", "()Ljava/net/URI;", "")>]
member this.Normalize : unit -> Java.Net.URI

Returns

URI

A URI equivalent to this URI, but whose path is in normal form

Attributes

Remarks

Normalizes this URI's path.

If this URI is opaque, or if its path is already in normal form, then this URI is returned. Otherwise a new URI is constructed that is identical to this URI except that its path is computed by normalizing this URI's path in a manner consistent with RFC 2396, section&nbsp;5.2, step&nbsp;6, sub-steps&nbsp;c through&nbsp;f; that is:

<ol>

<li>

All "." segments are removed.

</li>

<li>

If a ".." segment is preceded by a non-".." segment then both of these segments are removed. This step is repeated until it is no longer applicable.

</li>

<li>

If the path is relative, and if its first segment contains a colon character (':'), then a "." segment is prepended. This prevents a relative URI with a path such as "a:b/c/d" from later being re-parsed as an opaque URI with a scheme of "a" and a scheme-specific part of "b/c/d". <b>(Deviation from RFC&nbsp;2396)</b>

</li>

</ol>

A normalized path will begin with one or more ".." segments if there were insufficient non-".." segments preceding them to allow their removal. A normalized path will begin with a "." segment if one was inserted by step 3 above. Otherwise, a normalized path will not contain any "." or ".." segments.

Java documentation for java.net.URI.normalize().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to