public
Created

  • Download Gist
CharStreamsExample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
package chaschev.t1;
 
import com.google.common.io.CharStreams;
import com.google.common.io.Files;
import it.unimi.dsi.lang.MutableString;
 
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
 
public class CharStreamsExample {
public static void main(String[] args) throws IOException {
File file = new File("pom.xml");
 
MutableString str = new MutableString((int) file.length());
CharStreams.copy(Files.newReaderSupplier(file, Charset.defaultCharset()), str);
System.out.println(str);
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.