class RxFiles {

  @Nonnull
  public Single<Boolean> isDirectory(@Nonnull final File directory) {
    checkNotNull(directory, "\'directory\' cannot be null.");
    
    return exists(directory).flatMap(exists -> exists ?
        Single.just(directory.isDirectory()) :
        Single.error(new IOException(format("Directory \'%1$s\' does not exist.", directory))));
  }

}