+ InputStream stream = new FileInputStream(file);
+ try {
+ return readSmallStream(stream);
+ } finally {
+ stream.close();
+ }
+ }
+
+ /**
+ * Read the whole {@link InputStream} content into a {@link String}.
+ *
+ * @param stream
+ * the {@link InputStream}
+ *
+ * @return the content
+ *
+ * @throws IOException
+ * in case of I/O error
+ */
+ public static String readSmallStream(InputStream stream) throws IOException {
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(stream));