List of usage examples for org.apache.commons.io FilenameUtils concat
public static String concat(String basePath, String fullFilenameToAdd)
From source file:com.turn.griffin.GriffinLibCacheUtil.java
public String getTempCacheFilePath(FileInfo fileInfo) { return FilenameUtils.concat(getTempCacheDirectory(fileInfo), cacheFileName(fileInfo)); }
From source file:com.turn.griffin.GriffinLibCacheUtil.java
public String getTempCacheCompressedFilePath(FileInfo fileInfo) { return FilenameUtils.concat(getTempCacheDirectory(fileInfo), cacheCompressedFileName(fileInfo)); }
From source file:com.xyphos.vmtgen.GUI.java
private void generateVMT() { if (-1 == lstFiles.getSelectedIndex()) { return;/*w w w .j a v a 2s . c o m*/ } String value = lstFiles.getSelectedValue().toString(); String path = FilenameUtils .separatorsToSystem(FilenameUtils.concat(workPath, FilenameUtils.getBaseName(value) + ".VMT")); File fileVMT = new File(path); try (PrintWriter out = new PrintWriter(fileVMT, "UTF-8")) { value = (0 == cmbShader.getSelectedIndex()) ? txtShader.getText() : cmbShader.getSelectedItem().toString(); // write the shader out.printf("\"%s\"%n{%n", value); writeSpinner(out, nudAlpha, 1F, "$alpha", 4); writeSpinner(out, nudEnvMapContrast, 0F, "$envMapContrast", 3); writeSpinner(out, nudEnvMapContrast, 0F, "$envMapSaturation", 2); writeSpinner(out, nudEnvMapFrame, 0, "$envMapFrame", 3); // write surfaces int index = cmbSurface1.getSelectedIndex(); if (0 != index) { value = (1 == index) ? txtSurface1.getText() : cmbSurface1.getSelectedItem().toString(); writeKeyValue(true, out, "$surfaceProp", value, 3); } index = cmbSurface2.getSelectedIndex(); if (0 != index) { value = (1 == index) ? txtSurface2.getText() : cmbSurface2.getSelectedItem().toString(); writeKeyValue(true, out, "$surfaceProp2", value, 3); } writeKeyValue(!(value = txtKeywords.getText()).isEmpty(), out, "%keywords", value, 3); writeKeyValue(!(value = txtToolTexture.getText()).isEmpty(), out, "%toolTexture", value, 3); writeKeyValue(!(value = txtBaseTexture1.getText()).isEmpty(), out, "$baseTexture", value, 3); writeKeyValue(!(value = txtBaseTexture2.getText()).isEmpty(), out, "$baseTexture2", value, 3); writeKeyValue(!(value = txtDetailTexture.getText()).isEmpty(), out, "$detail", value, 4); writeKeyValue(!(value = txtBumpMap1.getText()).isEmpty(), out, "$bumpMap", value, 3); writeKeyValue(!(value = txtBumpMap2.getText()).isEmpty(), out, "$bumpMap2", value, 3); writeKeyValue(!(value = txtEnvMap.getText()).isEmpty(), out, "$envMap", value, 3); writeKeyValue(!(value = txtEnvMapMask.getText()).isEmpty(), out, "$envMapMask", value, 3); writeKeyValue(!(value = txtNormalMap.getText()).isEmpty(), out, "$normalMap", value, 3); writeKeyValue(!(value = txtDuDvMap.getText()).isEmpty(), out, "$DuDvMap", value, 3); value = "1"; writeKeyValue(chkFlagAdditive.isSelected(), out, "$additive", value, 3); writeKeyValue(chkFlagAlphaTest.isSelected(), out, "$alphaTest", value, 3); writeKeyValue(chkFlagIgnoreZ.isSelected(), out, "$ignoreZ", value, 3); writeKeyValue(chkFlagNoCull.isSelected(), out, "$noCull", value, 4); writeKeyValue(chkFlagNoDecal.isSelected(), out, "$noDecal", value, 3); writeKeyValue(chkFlagNoLOD.isSelected(), out, "$noLOD", value, 3); writeKeyValue(chkFlagPhong.isSelected(), out, "$phong", value, 4); writeKeyValue(chkFlagSelfIllum.isSelected(), out, "$selfIllum", value, 3); writeKeyValue(chkFlagTranslucent.isSelected(), out, "$translucent", value, 3); writeKeyValue(chkFlagVertexAlpha.isSelected(), out, "$vertexAlpha", value, 3); writeKeyValue(chkFlagVertexColor.isSelected(), out, "$vertexColor", value, 3); writeKeyValue(chkCompileClip.isSelected(), out, "%compileClip", value, 3); writeKeyValue(chkCompileDetail.isSelected(), out, "%compileDetail", value, 3); writeKeyValue(chkCompileFog.isSelected(), out, "%compileFog", value, 3); writeKeyValue(chkCompileHint.isSelected(), out, "%compileHint", value, 3); writeKeyValue(chkCompileLadder.isSelected(), out, "%compileLadder", value, 3); writeKeyValue(chkCompileNoDraw.isSelected(), out, "%compileNoDraw", value, 3); writeKeyValue(chkCompileNoLight.isSelected(), out, "%compileNoLight", value, 3); writeKeyValue(chkCompileNonSolid.isSelected(), out, "%compileNonSolid", value, 2); writeKeyValue(chkCompileNpcClip.isSelected(), out, "%compileNpcClip", value, 3); writeKeyValue(chkCompilePassBullets.isSelected(), out, "%compilePassBullets", value, 2); writeKeyValue(chkCompilePlayerClip.isSelected(), out, "%compilePlayerClip", value, 2); writeKeyValue(chkCompilePlayerControlClip.isSelected(), out, "%compilePlayerControlClip", value, 2); writeKeyValue(chkCompileSkip.isSelected(), out, "%compileSkip", value, 3); writeKeyValue(chkCompileSky.isSelected(), out, "%compileSky", value, 3); writeKeyValue(chkCompileTrigger.isSelected(), out, "%compileTrigger", value, 3); // animation code if (animated) { value = nudFrameRate.getValue().toString(); out.printf("%n\t\"proxies\"%n"); out.printf("\t{%n"); out.printf("\t\t\"animatedTexture\"%n"); out.printf("\t\t{%n"); out.printf("\t\t\t\"animatedTextureVar\"\t\t\"$baseTexture\"%n"); out.printf("\t\t\t\"animatedTextureFrameNumVar\"\t\"$frame\"%n"); out.printf("\t\t\t\"animatedTextureFrameRate\" \t\"%s\"%n", value); out.printf("\t\t}%n"); out.printf("\t}%n"); } out.print("}"); out.flush(); try { URL url = this.getClass().getClassLoader().getResource("blip.wav"); AudioInputStream audioIn = AudioSystem.getAudioInputStream(url); clipBlip = AudioSystem.getClip(); clipBlip.open(audioIn); clipBlip.start(); } catch (LineUnavailableException | UnsupportedAudioFileException | IOException ex) { logger.log(Level.SEVERE, null, ex); } } catch (FileNotFoundException | UnsupportedEncodingException ex) { logger.log(Level.SEVERE, null, ex); } }
From source file:com.turn.griffin.GriffinLibCacheUtil.java
public String getTempCacheDirectory(FileInfo fileInfo) { return FilenameUtils.concat(FilenameUtils.concat(getTempCacheDirectory(), fileInfo.getFilename()), Long.toString(fileInfo.getVersion())); }
From source file:com.turn.griffin.GriffinLibCacheUtil.java
public String getTempCacheDirectory() { return FilenameUtils.concat( GriffinConfig.getProperty(GriffinModule.PROPERTY_PREFIX + "TempCacheDir", "/tmp/griffin-tmpcache"), this.myServerId); }
From source file:net.certiv.antlr.project.regen.ReGen.java
private void writeStgImportsStmt(Template tmpl) throws IOException { for (String name : tmpl.imports) { name = FilenameUtils.concat(config.getTemplatePath(), name); name = Strings.setExtension(name, ConfigBase.templateGroupExt); writeLine(tmpl.tmplFile, "import \"" + name + "\""); Log.debug(this, "Importing: " + name); }// w w w . ja v a 2s. c o m }
From source file:com.turn.griffin.GriffinLibCacheUtil.java
public String getForensicCacheDirectory() { String dir = FilenameUtils.concat(GriffinConfig.getProperty( GriffinModule.PROPERTY_PREFIX + "ForensicCacheDir", "/tmp/griffin-forensic"), this.myServerId); if (!new File(dir).exists()) { try {/*from www . jav a 2 s .com*/ FileUtils.forceMkdir(new File(dir)); } catch (IOException ioe) { logger.error(String.format("Unable to create forensic file repository %s", dir), ioe); Preconditions.checkState(false); } } return dir; }
From source file:edu.cornell.med.icb.goby.modes.TestSplicedSamHelper.java
@Test // like 9 no genome public void testSamToCompactTrickCase9NoGenome() throws IOException { SAMToCompactMode importer = new SAMToCompactMode(); importer.setInputFile("test-data/splicedsamhelper/tricky-spliced-9.sam"); final String outputFilename = FilenameUtils.concat(BASE_TEST_DIR, "spliced-output-alignment-9"); importer.setOutputFile(outputFilename); importer.execute();/*from w ww . ja va2s. com*/ AlignmentReader reader = new AlignmentReaderImpl(outputFilename); assertTrue(reader.hasNext()); Alignments.AlignmentEntry first = reader.next(); assertEquals(0, first.getQueryIndex()); assertEquals(0, first.getFragmentIndex()); assertEquals(3 - 1, first.getPosition()); }
From source file:edu.cornell.med.icb.goby.readers.sam.TestSamRecordParser.java
/** * Test round trip of tricky-spliced-18.sam that input and output * sam compare.// w w w. j a v a 2s .c o m * * @throws IOException error */ @Test public void testRoundTripTrickySpliced18() throws IOException { final RoundTripAlignment rtc = new RoundTripAlignment(); rtc.inputGenomeFilename = TestGobyPaperTop5000s.findThousandGenome(); rtc.sourceBamFilename = "test-data/splicedsamhelper/tricky-spliced-18.sam"; rtc.destGobyBasename = FilenameUtils.concat(BASE_TEST_OUTPUT_DIR, "tricky-spliced-18"); rtc.destBamFilename = FilenameUtils.concat(BASE_TEST_OUTPUT_DIR, "tricky-spliced-18.sam"); rtc.testRoundTripAny(); rtc.keepQualityScores = false; rtc.testRoundTripAny(); rtc.keepSoftClips = false; rtc.testRoundTripAny(); }
From source file:fr.ippon.wip.portlet.WIPConfigurationPortlet.java
/** * Process the user action: a configuration can be deleted, selected or * saved.//from w w w . j av a2s .com */ @Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { PortletSession session = request.getPortletSession(); if (fileUploadPortlet.isMultipartContent(request)) { try { List<DiskFileItem> fileItems = fileUploadPortlet.parseRequest(request); for (DiskFileItem fileItem : fileItems) { // TODO : ??? String newName = FilenameUtils.concat(deployPath, fileItem.getName()); File file = fileItem.getStoreLocation(); file.renameTo(new File(newName)); } request.setAttribute(Attributes.PAGE.name(), Pages.EXISTING_CONFIG.name()); } catch (FileUploadException e) { e.printStackTrace(); } return; } String page = request.getParameter(Attributes.PAGE.name()); if (!StringUtils.isEmpty(page)) { session.setAttribute(Attributes.PAGE.name(), Pages.valueOf(page)); return; } String configName = request.getParameter(Attributes.ACTION_SELECT_CONFIGURATION.name()); if (!StringUtils.isEmpty(configName) && configurationDAO.exists(configName)) { session.setAttribute(Attributes.CONFIGURATION_NAME.name(), configName); session.setAttribute(Attributes.PAGE.name(), Pages.GENERAL_SETTINGS); return; } configName = request.getParameter(Attributes.ACTION_DELETE_CONFIGURATION.name()); if (!StringUtils.isEmpty(configName)) { if (WIPUtil.getConfiguration(request).getName().equals(configName)) session.setAttribute(Attributes.CONFIGURATION_NAME.name(), AbstractConfigurationDAO.DEFAULT_CONFIG_NAME); configurationDAO.delete(configurationDAO.read(configName)); return; } configName = request.getParameter(Attributes.ACTION_SAVE_CONFIGURATION_AS.name()); if (!StringUtils.isEmpty(configName)) { WIPConfiguration configuration = WIPUtil.getConfiguration(request); WIPConfiguration newConfiguration = (WIPConfiguration) configuration.clone(); newConfiguration.setName(configName); newConfiguration = configurationDAO.create(newConfiguration); session.setAttribute(Attributes.CONFIGURATION_NAME.name(), newConfiguration.getName()); session.setAttribute(Attributes.PAGE.name(), Pages.GENERAL_SETTINGS); return; } if (request.getParameter("form") != null) { switch (Integer.valueOf(request.getParameter("form"))) { case 1: handleGeneralSettings(request, response); break; case 2: handleClipping(request, response); break; case 3: handleHtmlRewriting(request, response); break; case 4: handleCSSRewriting(request, response); break; case 5: handleJSRewriting(request, response); break; case 6: handleCaching(request, response); break; case 7: handleLTPAAuthentication(request, response); break; } } }