/** * Reads the first line from a file. The line does not include * line-termination characters, but does include other leading and * trailing whitespace. * * @param file the file to read from * @param charset the character set used when writing the file * @return the first line, or null if the file is empty * @throws IOException if an I/O error occurs */ public static String readFirstLine(File file, Charset charset) throws IOException { return CharStreams.readFirstLine(Files.newReaderSupplier(file, charset)); }
/** * Reads the first line from a file. The line does not include * line-termination characters, but does include other leading and * trailing whitespace. * * @param file the file to read from * @param charset the character set used when writing the file * @return the first line, or null if the file is empty * @throws IOException if an I/O error occurs */ public static String readFirstLine(File file, Charset charset) throws IOException { return CharStreams.readFirstLine(Files.newReaderSupplier(file, charset)); }
/** * Reads the first line from a file. The line does not include * line-termination characters, but does include other leading and * trailing whitespace. * * @param file the file to read from * @param charset the character set used when writing the file * @return the first line, or null if the file is empty * @throws IOException if an I/O error occurs */ public static String readFirstLine(File file, Charset charset) throws IOException { return CharStreams.readFirstLine(Files.newReaderSupplier(file, charset)); }
String line = CharStreams.readFirstLine( CharStreams.newReaderSupplier( Locations.newInputSupplier(resultLocation), Charsets.UTF_8));