title: How to read from a txt file in an http address from Java
body: <p>I have an address like: "<a href="http://address.com/f1/f2/data.txt" rel="nofollow">http://address.com/f1/f2/data.txt</a>"</p>
  
  <p>I'm implementing a Java program that needs to read from the text file, data.txt, preferably line by line, looking for a pattern.</p>
  
  <p>I've searched, what I found  and tried was using BufferedReader and Jsoup(I know that using Jsoup doen't make that sense bacause the file is a text file not a html, but I tried it). None of them worked fine and in both I got this error:
  (No such file or directory)</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public static String getData(String path, String pattern) {
      StringBuilder contentBuilder = new StringBuilder();
      String str ="";
      try {
          BufferedReader in = new BufferedReader(new FileReader(path));
          while ((str = in.readLine()) != null) {
              System.out.println(str);
              if (str.equals(pattern))
                  break;
          }
         str = in.readLine();
         in.close();
         } catch (IOException e) {
             System.out.println(e.toString());
         }
      return str;
  </code></pre>
  
  <p>} </p>
  
  <p>Any clue how to read this file?</p>