Reputation: 189
Question # 1: what is the difference between raw and encoded strings in a Uri and why would it be more appropriate to use one or the other? E.G.
Uri.Builder builder = new Uri.Builder();
builder.scheme("http://");
builder.encodedScheme("http://"); //vs the encoded version
Question # 2: when setting the "scheme://authority/path?#fragment" on a Uri.Builder() object where do ":, //, ?, #" go in respect to the methods that set the various part of the Builder object? assume it's a heirarchal URI E.G.
builder.scheme("http://"); //or
builder.scheme("http:"); // or just
builder.scheme("http"); //and then append the ":" and "//" elsewhere?
Any help would be greatly appreciated, so thank you in advanced :).
Upvotes: 0
Views: 40
Reputation: 1006819
what is the difference between raw and encoded strings in a Uri
Encoded strings are ones that are already URL-encoded. Raw strings are not.
Note that there is no encodedScheme()
method on Uri.Builder
.
why would it be more appropriate to use one or the other?
If your string is already encoded, from wherever you got that string from, use encoded...()
. If not, don't.
where do ":, //, ?, #" go
Nowhere. The point behind Uri
and Uri.Builder
is, in part, to add that stuff for you.
Upvotes: 2