read folder structure from a text file and create the structure - java
<p>I have text file with content like below list a folder structure:</p>

<pre><code>/root1

    /folder1
        /file1
    /folder2
        /file1
    /folder3
        /file1
/root2

    /folder1
        /file1
    /folder2
        /file1
    /folder3
        /file1
</code></pre>

<p>Is there any better way to implement a java program for solving this kind of problem? Or I just have to read through each line in the file? </p>

<p>I am new to Java to not sure what better libraries are there for reading files in Java. </p>

<p>Thank you.</p>