Skip to content

Instantly share code, notes, and snippets.

@chaschev
Created October 22, 2013 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaschev/7106875 to your computer and use it in GitHub Desktop.
Save chaschev/7106875 to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment