Created
October 22, 2013 19:41
-
-
Save chaschev/7106875 to your computer and use it in GitHub Desktop.
Sample for http://stackoverflow.com/a/19495505/1851024
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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