<p>What ist most concise way to read the contents of a file or input stream in Java? Do I always have to create a buffer, read (at most) line by line and so on or is there a more concise way? I wish I could do just</p>

<pre><code>String content = new File("test.txt").readFully();
</code></pre>

```
```
String content = (new RandomAccessFile(new File("test.txt"))).readUTF();
```
```
Unfortunately Java is very picky about the source file being valid UTF8 though, or you will get an EOFException or UTFDataFormatException.