Reads all characters from a file into a {@link String}, using the given character set. @param file the file to read from @param charset the charset used to decode the input stream; see {@link StandardCharsets} for helpful predefined constants @return a string containing all the characters from
(File file, Charset charset)
| 248 | * @deprecated Prefer {@code asCharSource(file, charset).read()}. |
| 249 | */ |
| 250 | @Deprecated |
| 251 | @InlineMe( |
| 252 | replacement = "Files.asCharSource(file, charset).read()", |
| 253 | imports = "com.google.common.io.Files") |
| 254 | public static String toString(File file, Charset charset) throws IOException { |
| 255 | return asCharSource(file, charset).read(); |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Overwrites a file with the contents of a byte array. |