You can use Scanner
to read all of the text in the input as a String, by using \Z
(entire input) as the delimiter. For example, this can be used to read all text in a text file in one line:
String content = new Scanner(new File("filename")).useDelimiter("\\Z").next();
System.out.println(content);
Remember that you'll have to close the Scanner, as well as catch the IoException
this may throw, as described in the example Reading file input using Scanner.