MCPcopy Create free account
hub / github.com/PCGen/pcgen / getOutputExtension

Method getOutputExtension

code/src/java/pcgen/io/ExportUtilities.java:73–91  ·  view source on GitHub ↗

Retrieve the extension that should be used for the output file. This is base don the template name. @param templateFilename The filename of the export template. @param isPdf Is this an export to a PDF file? @return The output filename extension.

(String templateFilename, boolean isPdf)

Source from the content-addressed store, hash-verified

71 * @return The output filename extension.
72 */
73 public static String getOutputExtension(String templateFilename, boolean isPdf)
74 {
75 if (isPdf)
76 {
77 return "pdf";
78 }
79
80 if (templateFilename.endsWith(".ftl"))
81 {
82 templateFilename = templateFilename.substring(0, templateFilename.length() - 4);
83 }
84 String extension = StringUtils.substringAfterLast(templateFilename, ".");
85 if (StringUtils.isEmpty(extension))
86 {
87 extension = StringUtils.substringAfterLast(templateFilename, "-");
88 }
89
90 return extension;
91 }
92
93 /**
94 * Identify if this template will result in a pdf file.

Callers 8

isPdfTemplateMethod · 0.95
getTempOutputFilenameMethod · 0.95
exportPartyToPDFMethod · 0.95
doExportEntirePartyMethod · 0.95

Calls 1

isEmptyMethod · 0.65

Tested by 2