Retrieve rich text from GridFS with Java
Since you are already on Java 7, you can use try-with-resources on your BufferedReader for safe and efficient handling of the underlying I/O resource.

Also, if all you are interested in is to read a file contents as a single String, you can consider reading them into a String, and then there appears to be three simple ways using either Guava, Apache Commons IO or Spark (web framework) libraries:

// Guava
String content = new String(ByteStreams.toByteArray(is));
// Apache Commons IO
String content = IOUtils.toString(is, Charset.defaultCharset());
// Spark (web framework)
String content = IOUtils.toString(is);


Where applicable, it's recommended to specify the Charset explicitly, instead of relying on the default.

One difference with this approach is that newlines aren't normalized to System.getProperty("line.separator") like what you have done here. If this is crucial for your usage, then a slight refactoring can be:

private static String getStringFromInputStream(InputStream is) {
    try (InputStreamReader source = new InputStreamReader(is);
            BufferedReader bufferedReader = new BufferedReader(source)) {
        StringBuilder builder = new StringBuilder();
        // using for-loop for nicer scoping of 'line' variable
        for (String line = bufferedReader.readLine(); line != null;
                line = bufferedReader.readLine()) {
            if (builder.length() &gt; 0) {
                builder.append(System.lineSeparator());
            }
            builder.append(line);
        }
        return builder.toString();
    } catch (IOException e) {
        // recommended to do something about it instead of just printStackTrace()
        // e.printStackTrace();
    }
}


Since you also suggest giving ideas about Java 8, you can use StringJoiner as a slightly better replacement - there is no need to handle the appending of System.lineSeparator() manually:

private static String getStringFromInputStream(InputStream is) {
    try (InputStreamReader source = new InputStreamReader(is);
            BufferedReader bufferedReader = new BufferedReader(source)) {
        StringJoiner builder = new StringJoiner(System.lineSeparator());
        for (String line = bufferedReader.readLine(); line != null;
                line = bufferedReader.readLine()) {
            joiner.add(line);
        }
        return joiner.toString();
    } catch (IOException e) {
        // do something
    }
}