/** * This function returns a unique category output path for the specified category. It is of the * form "<base output path>/yyMMdd/<category>/HHmmssSSS" * * @param category the name of the category * @return the canonical path of the unique category output path * @throws IOException */ public static String getUniqueCategoryOutputPath(String category) throws IOException { String categoryOutputPath = FileManager.getCategoryOutputPath(category); String timeStamp = FileManager.getTimeStamp(); String uniqueCategoryOutputPath = FileManager.createDirectory(categoryOutputPath + timeStamp); FileManager.pause(); return uniqueCategoryOutputPath + System.getProperty("file.separator"); }
public static String getUniqueFilePath(String basename, String extention) throws IOException { return FileManager.getDailyOutputPath() + System.getProperty("file.separator") + basename + "." + extention; }
public static void main(String[] args) { options = createOptions(); CommandLineParser parser = new GnuParser(); try { CommandLine line = parser.parse(options, args); String complexFile = line.getOptionValue("complex"); String pointsFile = line.getOptionValue("points"); String outputFile = null; if (line.hasOption("destination")) { outputFile = line.getOptionValue("destination"); } else { outputFile = FileManager.generateUniqueFileName() + ".pov"; } renderFromFiles(complexFile, pointsFile, outputFile); } catch (ParseException exp) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("plex-viewer", options); } catch (IOException e) { e.printStackTrace(); } }
/** * This function returns the category output path. It is of the form "<base output * path>/yyMMdd/<category>/". * * @param category the name of the category * @return the canonical path of the category output path * @throws IOException */ public static String getCategoryOutputPath(String category) throws IOException { if (!FileManager.categoryOutputPaths.containsKey(category)) { FileManager.initializeCategoryOutputPath(category); } return FileManager.categoryOutputPaths.get(category) + System.getProperty("file.separator"); }
/** * This function returns the daily output path. It is of the form "<base output path>/yyMMdd/". * * @return the daily output path * @throws IOException */ public static String getDailyOutputPath() throws IOException { if (FileManager.dailyOutputPath == "") { FileManager.initializeDailyOutputPath(); } return FileManager.dailyOutputPath + System.getProperty("file.separator"); }
/** * This function creates a unique filename. It is actually of the form yyMMddHHmmssSSS. The * filename does not have any extension. * * @return a filename of the form yyMMddHHmmssSSS */ public static String generateUniqueFileName() { SimpleDateFormat formatter = new SimpleDateFormat("yy-MM-dd-HH-mm-ss-SSS"); String name = formatter.format(new Date()); FileManager.pause(); return name; }
/** * This function initializes the category output path as defined above. * * @param category the name of the category * @throws IOException */ private static void initializeCategoryOutputPath(String category) throws IOException { String outputPath = FileManager.createDirectory(getDailyOutputPath() + category); FileManager.categoryOutputPaths.put(category, outputPath); }
/** * This function initializes the daily output path as defined above. * * @throws IOException */ private static void initializeDailyOutputPath() throws IOException { SimpleDateFormat formatter = new SimpleDateFormat("yy-MM-dd"); String dateString = formatter.format(new Date()); FileManager.dailyOutputPath = FileManager.createDirectory(getBaseOutputPath() + dateString); }