### Question:
DLFileSystem extends FileSystem { @Override public FSDataOutputStream append(Path path, int bufferSize, Progressable progressable) throws IOException { return append(path, bufferSize, Optional.empty()); } DLFileSystem(); @Override URI getUri(); @Override void initialize(URI name, Configuration conf); @Override void close(); @Override Path getHomeDirectory(); @Override void setWorkingDirectory(Path path); @Override Path getWorkingDirectory(); @Override FSDataInputStream open(Path path, int bufferSize); @Override FSDataOutputStream create(Path path,
                                     FsPermission fsPermission,
                                     boolean overwrite,
                                     int bufferSize,
                                     short replication,
                                     long blockSize,
                                     Progressable progressable); @Override FSDataOutputStream append(Path path,
                                     int bufferSize,
                                     Progressable progressable); @Override boolean delete(Path path, boolean recursive); @Override FileStatus[] listStatus(Path path); @Override boolean mkdirs(Path path, FsPermission fsPermission); @Override FileStatus getFileStatus(Path path); @Override boolean rename(Path src, Path dst); @Override boolean truncate(Path f, long newLength); static final String DLFS_CONF_FILE; }### Answer:
@Test public void testAppend() throws Exception { Path path = new Path("/path/to/" + runtime.getMethodName()); assertFalse(fs.exists(path)); byte[] originData = "original".getBytes(UTF_8); try (FSDataOutputStream out = fs.create(path)) { out.write(originData); out.flush(); } try (FSDataInputStream in = fs.open(path, 1024)) { assertEquals(originData.length, in.available()); byte[] readData = new byte[originData.length]; assertEquals(originData.length, in.read(readData)); assertArrayEquals(originData, readData); } byte[] appendData = "append".getBytes(UTF_8); try (FSDataOutputStream out = fs.append(path, 1024)) { out.write(appendData); out.flush(); } try (FSDataInputStream in = fs.open(path, 1024)) { assertEquals(originData.length + appendData.length, in.available()); byte[] readData = new byte[originData.length]; assertEquals(originData.length, in.read(readData)); assertArrayEquals(originData, readData); readData = new byte[appendData.length]; assertEquals(appendData.length, in.read(readData)); assertArrayEquals(appendData, readData); } }