public static FileSystem write(final FileSystem fs, final Path path,
      final byte[] bytes) throws IOException {

    Objects.requireNonNull(path);
    Objects.requireNonNull(bytes);

    try (FSDataOutputStream out = fs.createFile(path).overwrite(true).build()) {
      out.write(bytes);
    }

    return fs;
  }
@Test
  public void testWriteStringFileSystem() throws IOException {
    URI uri = tmp.toURI();
    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(uri, conf);
    Path testPath = new Path(new Path(uri), "writestring.out");

    String write = "A" + "\u00ea" + "\u00f1" + "\u00fc" + "C";

    FileUtil.write(fs, testPath, write, StandardCharsets.UTF_8);

    String read = FileUtils.readFileToString(new File(testPath.toUri()),
        StandardCharsets.UTF_8);

    assertEquals(write, read);
  }