class AdbFileOperations {

  @NotNull
  public ListenableFuture<Void> createNewFileRunAs(@NotNull String parentPath, @NotNull String fileName, @Nullable String runAs) {
    return myExecutor.executeAsync(() -> {
      if (fileName.contains(AdbPathUtil.FILE_SEPARATOR)) {
        throw AdbShellCommandException.create("File name \"%s\" contains invalid characters", fileName);
      }

      String remotePath = AdbPathUtil.resolve(parentPath, fileName);

      // Check remote file does not exists, so that we can give a relevant error message.
      // The check + create below is not an atomic operation, but this service does not
      // aim to guarantee strong atomicity for file system operations.
      String command;
      if (myDeviceCapabilities.supportsTestCommand()) {
        command = getCommand(runAs, "test -e ").withEscapedPath(remotePath).build();
      }
      else {
        command = getCommand(runAs, "ls -d -a ").withEscapedPath(remotePath).build();
      }
      AdbShellCommandResult commandResult = AdbShellCommandsUtil.executeCommand(myDevice, command);
      if (!commandResult.isError()) {
        throw AdbShellCommandException.create("File \"%s\" already exists on device", remotePath);
      }

      touchFileRunAs(remotePath, runAs);

      // All done
      return null;
    });
  }

  public  AdbFileOperations(@NotNull IDevice device, @NotNull AdbDeviceCapabilities deviceCapabilities, @NotNull Executor taskExecutor);

}