List of usage examples for org.apache.hadoop.hdfs DistributedFileSystem append
public FSDataOutputStream append(Path f) throws IOException
From source file:backup.integration.MiniClusterTestBase.java
License:Apache License
private void writeFile(DistributedFileSystem fileSystem, Path path) throws IOException, InterruptedException { try (FSDataOutputStream outputStream = fileSystem.create(path)) { for (int i = 0; i < 10; i++) { outputStream.write("abc".getBytes()); outputStream.hsync();/*from ww w. j a v a 2 s.c o m*/ Thread.sleep(50); } } try (FSDataOutputStream outputStream = fileSystem.append(path)) { for (int i = 0; i < 10; i++) { outputStream.write("abc".getBytes()); outputStream.hsync(); Thread.sleep(50); } } }