class RxFiles {

  @Nonnull
  public Single<Long> sizeInBytes(@Nonnull final File file) {
    checkNotNull(file, "\'file\' must not be null.");
    
    return exists(file).flatMap(exists -> exists ?
        Single.fromCallable(file::length) :
        Single.error(new IOException(format("File \'%1$s\' does not exist.", file))));
  }

}