Created
April 29, 2013 02:45
bufferedStream
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
@Test | |
public void bufferedStreams() throws Exception { | |
Path path = Paths.get("channel.txt"); | |
try (BufferedWriter writer = Files.newBufferedWriter(path, UTF8, StandardOpenOption.CREATE, StandardOpenOption.APPEND)) { | |
for (int i = 0; i < 100; i++) { | |
writer.write(TEST_TEXT); | |
} | |
writer.flush(); | |
} | |
List<String> lines = Files.readAllLines(path, Charset.forName("UTF-8")); | |
for (String line : lines) | |
System.out.println(line); | |
Files.deleteIfExists(path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment