How to Hadoop Path to Java File
<p>I am working on code which processes File objects. I would like to store the actual files in HDFS, but to retrieve them as File objects.
I found the method pathToFile (Hadoop LocalFileSystem), which supposedly does exactly what I want, but it doesn't seem to work.
There is another question with almost the same topic (<a href="https://stackoverflow.com/questions/3444313/how-to-convert-a-hadoop-path-object-into-a-java-file-object">How to convert a Hadoop Path object into a Java File object</a>) but it isn't solved.</p>

<p>Is there anyone who actually used the method and converted a Hadoop Path to a Java File?</p>

<p>fyi: I searched all over the Internet and I couldn't find not even a chunk of code where the pathToFile is used and works efficiently.</p>

<p>In my code:</p>

<pre><code>String uri = args[0]; //give the hdsf path as argument
Configuration conf = new Configuration(); //create a Configuration obj
Path pathOfFile = new Path(uri); //create a Hadoop Path obj
LocalFileSystem myFS = FileSystem.getLocal(conf); //LocalFileSystem creation
File theFile = myFS.pathToFile(pathOfFile); // using pathToFile
</code></pre>