Java: One-liner for InputStream to String

Published:

Just what the title says, for future reference 🙂

String text = new Scanner(inputStream, charset)
  .useDelimiter("\\A")
  .next();