-Converting a Path to a full URI String and preserving special characters
Public Network Services 2013-08-08, 23:54
Is there a reliable way of converting an HDFS Path object into a String?
Invoking path.toUri().toString() does not work with special characters
(e.g., if there are spaces in the original path string). So, for instance,
in the following example
String address = ...; // Path string without the hdfs://.../ prefix and
with special characters
Path path = new Path(address);
String pathString = path.toString();
the string variables "address" and "pathString" are not identical.
What I am after is a way to always get the full URL (including the
hdfs://.../ prefix) from a string address converted to a path and then back
to a string, even if the original address did not include the the
My impression was that this is done via path.toString() all the time, but I
am getting some results where this is not the case.