code: private Resource createReplacementResource(final Resource resource, final int partitionNumber) {
          final String formattedPartitionNumber = String.format("%05d", partitionNumber);
          if (resource instanceof HdfsResource || resource instanceof HadoopResource) {
              final String path = resource.getQualifiedPath() + "/part-" + formattedPartitionNumber;
              final URI uri = URI.create(path);
              return HdfsHelper.createHelper().getResourceToUse(uri);
          }
          if (resource instanceof FileResource) {
              final File file = ((FileResource) resource).getFile();
              if (file.exists() && file.isFile()) {
                  // a file already exists - we cannot just create a directory
                  // then
                  return resource;
              }
              if (!file.exists()) {
                  file.mkdirs();
              }
              return new FileResource(resource.getQualifiedPath() + "/part-" + formattedPartitionNumber);
          }
          return null;
      }
docs: Creates a {@link Resource} replacement to use for configured properties.
  
  @param resource
  @param partitionNumber
  @return a replacement resource, or null if it shouldn't be replaced