List of usage examples for org.apache.hadoop.fs FileSystem append
public FSDataOutputStream append(Path f) throws IOException
From source file:org.trustedanalytics.utils.hdfs.HdfsConfigFactoryTest.java
License:Apache License
private void testAppendFunction(FileSystem fs, LocatedFileStatus remoteFile) throws IOException { try (OutputStream out = fs.append(remoteFile.getPath())) { out.write(APPEND_TEXT.getBytes()); }//from www .j a v a 2 s. c om try (InputStreamReader in = new InputStreamReader(fs.open(remoteFile.getPath())); BufferedReader br = new BufferedReader(in)) { String content = br.readLine(); assert br.readLine() == null; assertThat("File was not appended properly", content, containsString(APPEND_TEXT)); } }