title: Reading an InputStream in Java
body: <p>I'm new to Java thus the question,</p>
  
  <p>I'm using the following class to read a file into a string.</p>
  
  <pre><code>public class Reader {
  
      public static String readFile(String fileName) throws IOException {
          BufferedReader br = new BufferedReader(new FileReader(fileName));
          try {
              StringBuilder sb = new StringBuilder();
              String line = br.readLine();
  
              while (line != null) {
                  sb.append(line);
                  sb.append("\n");
                  line = br.readLine();
              }
              return sb.toString();
          } finally {
              br.close();
          }
      }
  
  }
  </code></pre>
  
  <p>How can I modify the method signature of read to read a InputStream as opposed to a string.</p>