Get the file name to be used by the writer. If a {@link org.apache.gobblin.writer.partitioner.WriterPartioner} is used,
the partition will be added as part of the file name.
16746
public String getFileName(State properties) {

    String extension =
        this.format.equals(WriterOutputFormat.OTHER) ? getExtension(properties) : this.format.getExtension();
    String fileName = WriterUtils.getWriterFileName(properties, this.branches, this.branch, this.writerId, extension);

    if (this.partition.isPresent()) {
      fileName = getPartitionedFileName(properties, fileName);
    }

    List<StreamCodec> encoders = getEncoders();
    if (!encoders.isEmpty()) {
      StringBuilder filenameBuilder = new StringBuilder(fileName);
      for (StreamCodec codec : encoders) {
        filenameBuilder.append('.');
        filenameBuilder.append(codec.getTag());
      }

      fileName = filenameBuilder.toString();
    }

    return fileName;
  }
452075
public String getSubmittedFileName() {
        // TODO this method also introduced in servlet 3.1 specification (delegate to part when I adopt servlet 3.1)
        if (submittedFileName == null) {
            String header = part.getHeader(HttpConstants.Header.CONTENT_DISPOSITION);
            if (header == null) {
                return null;
            }

            for (String headerPart : header.split(";")) {
                if (headerPart.trim().startsWith("filename")) {
                    submittedFileName = headerPart.substring(headerPart.indexOf('=') + 1).trim().replace("\"", "");
                    break;
                }
            }
        }

        return submittedFileName;
    }
948443
protected String toFilename(QualifiedName name, String separator) {
		final List<String> segments = name.getSegments();
		if (segments.isEmpty()) {
			return ""; //$NON-NLS-1$
		}
		final StringBuilder builder = new StringBuilder();
		builder.append(name.toString(separator));
		builder.append(getFilenameExtension());
		return builder.toString();
	}
1024632
function getFullFilename(filename) {
  if (p.isAbsolute(filename)) {
    return filename
  }
  return p.join(process.cwd(), filename)
}
761179
def safe_filename(self, part):
        ''''''
        return safe_filename(
            part,
            os_type=self._os_type, no_control=self._no_control,
            ascii_only=self._ascii_only, case=self._case,
            max_length=self._max_filename_length,
            )
1096573
public long id() {
    return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR, file.getName().lastIndexOf(PART_SEPARATOR) - 1) + 1, file.getName().lastIndexOf(PART_SEPARATOR)));
  }
812472
private static File writePartToFile(File splitDir, List<String> data) {
        BufferedWriter writer = null;
        File splitFile;
        try {
            splitFile = File.createTempFile("split-", ".part", splitDir);
            writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(splitFile.getAbsoluteFile(), false),
                    DataUtilDefaults.charSet));
            for(String item : data) {
                writer.write(item + DataUtilDefaults.lineTerminator);
            }
            writer.flush();
            writer.close();
            writer = null;
        } catch (UnsupportedEncodingException e) {
            throw new DataUtilException(e);
        } catch (FileNotFoundException e) {
            throw new DataUtilException(e);
        } catch (IOException e) {
            throw new DataUtilException(e);
        } finally {
            if(writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    // Intentionally we're doing nothing here
                }
            }
        }
        return splitFile;
    }
501228
protected String toFilename(final Resource resource) throws UnsupportedOperationException {
        if (resource instanceof FileResource) {
            return ((FileResource) resource).getFile().getPath();
        }

        throw new UnsupportedOperationException("Unsupported resource type: " + resource);
    }
373223
String getResourceName(String fileName) {
        // FIXME: there is probably a more robust way to do this

        // Strip off the directory part.
        String dirPath = directory.getPath();
        if (!fileName.startsWith(dirPath)) {
            throw new IllegalStateException("Filename " + fileName + " not inside directory " + dirPath);
        }

        // The problem here is that we need to take the relative part of the
        // filename
        // and break it into components that we can then reconstruct into
        // a resource name (using '/' characters to separate the components).
        // Unfortunately, the File class does not make this task particularly
        // easy.

        String relativeFileName = fileName.substring(dirPath.length());
        File file = new File(relativeFileName);
        LinkedList<String> partList = new LinkedList<>();
        do {
            partList.addFirst(file.getName());
        } while ((file = file.getParentFile()) != null);

        StringBuilder buf = new StringBuilder();
        for (String part : partList) {
            if (buf.length() > 0) {
                buf.append('/');
            }
            buf.append(part);
        }

        return buf.toString();
    }
1019835
def filename(self):
        
        if self._filename:
            return self._filename
        else:
            with tempfile.NamedTemporaryFile(delete=False) as f:
                f.write(self._bytes)
            return f.name
1185991
public Partition addPartition(String partitionId, String partitionDn) throws Exception {
        Log.info(c, "addPartition", "entry " + partitionId + " " + partitionDn);
        JdbmPartition partition = new JdbmPartition(this.service.getSchemaManager());
        partition.setId(partitionId);
        partition.setPartitionPath(new File(this.service.getInstanceLayout().getPartitionsDirectory(), partitionId).toURI());
        partition.setSuffixDn(new Dn(partitionDn));
        service.addPartition(partition);

        Log.info(c, "addPartition", "exit");
        return partition;
    }
597255
public String getFileName(String originalFileName) {

        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_targetFileName)) {
            return m_targetFileName;
        } else if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_targetFileNamePrefix)) {
            return m_targetFileNamePrefix + originalFileName;
        } else {
            return originalFileName;
        }
    }
695580
public static String getOriginalFileName(Part part) {
    String contentDisposition = part.getHeader("content-disposition");
    if (contentDisposition != null) {
      for (String cd : contentDisposition.split(";")) {

        if (cd.trim().startsWith("filename")) {
          String path = cd.substring(cd.indexOf('=') + 1).replaceAll("\"", "").trim();
          Path filename = Paths.get(path).getFileName();
          return StringUtils.hasText(filename.toString()) ? filename.toString() : null;
        }
      }
    }

    return null;
  }
644266
public String getName() {
		if(name != null) {
			return name;
		}
		if(root != null) {
			return root.getAbsolutePath().replace(File.separatorChar, SEPRTR);
		}
		return null;
	}
753651
protected String getFilename(Object result, String filenamepre) {
    if(filenamepre == null || filenamepre.length() == 0) {
      filenamepre = "result";
    }
    for(int i = 0;; i++) {
      String filename = i > 0 ? filenamepre + "-" + i : filenamepre;
      Object existing = filenames.get(filename);
      if(existing == null || existing == result) {
        filenames.put(filename, result);
        return filename;
      }
    }
  }
377388
public Schema getSchema() {
    if (this.partition.isPresent()) {
      String schemaString = this.partition.get().get(SchemaBasedWriterPartitioner.SCHEMA_STRING).toString();
      this.withSchema(new Schema.Parser().parse(schemaString));
      return this.schema;
    } else {
      return null;
    }
  }
236639
public OkRequest<T> part(final String name, final String filename,
                             final String contentType, final String part) throws IOException {

        startPart();
        writePartHeader(name, filename, contentType);
        mOutput.write(part);

        return this;
    }