SmosUtils { public static Date getSensingStartDayFromFilename(String fileName) { final String yearString = fileName.substring(19, 23); final String monthString = fileName.substring(23, 25); final String dayString = fileName.substring(25, 27); final int year = Integer.parseInt(yearString); final int month = Integer.parseInt(monthString); final int day = Integer.parseInt(dayString); final Calendar cal = DateTimeUtils.getUtcCalendar(); cal.set(year, month - 1, day); return cal.getTime(); }  static File findDblFile(File[] zipFiles); static Date getSensingStartDayFromFilename(String fileName); static Date getSensingStartTimeFromFilename(String fileName); static Date getSensingStopTimeFromFilename(String fileName); static String getProductType(String fileName); static boolean isDblFileName(String fileName); static boolean isHdrFileName(String fileName); static boolean isL0Type(String fileName); static boolean isL1aType(String fileName); static boolean isL1bType(String fileName); static boolean isL1cType(String fileName); static boolean isLightBufrType(String fileName); static boolean isLightBufrTypeSupported(); static boolean isL2Type(String fileName); static boolean isAuxFileType(String fileName); static boolean isQualityControlType(String fileName); static boolean isMirasPlanType(String fileName); static boolean isAuxECMWFType(String fileName); static boolean isOsAnalysisFormat(String formatName); static boolean isOsUserFormat(String formatName); static boolean isSmAnalysisFormat(String formatName); static boolean isSmUserFormat(String formatName); static boolean isDualPolBrowseFormat(String formatName); static boolean isFullPolBrowseFormat(String formatName); static boolean isBrowseFormat(String formatName); static boolean isDualPolScienceFormat(String formatName); static boolean isFullPolScienceFormat(String formatName); @SuppressWarnings("SimplifiableIfStatement") static boolean isCompressedFile(File file); static boolean isDggTlvFormat(String formatName); static boolean isDggTfoFormat(String formatName); static boolean isDggRouFormat(String formatName); static boolean isDggRfiFormat(String formatName); static boolean isDggFloFormat(String formatName); static boolean isLsMaskFormat(String formatName); static boolean isVTecFormat(String formatName); static boolean isDffLaiFormat(String formatName); static boolean isL2Format(String formatName);  }
@SuppressWarnings("MagicConstant") @Test public void testGetStartDateFromFilename() { final Calendar cal = GregorianCalendar.getInstance(); cal.set(2007, 0, 1); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_TEST_AUX_PATT99_20070101T000000_20781231T235959_00000006.EEF"))); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_TEST_AUX_BWGHT__20070101T000000_20781231T235959_00000003.EEF"))); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_TEST_AUX_RFI____20070101T000000_20781231T235959_00000001.EEF"))); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_TEST_AUX_RFI____20070101T235959_20781231T235959_00000001.EEF"))); cal.set(2007, 1, 23); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_TEST_AUX_VTEC___20070223T000000_20070224T000000_00000001.EEF"))); cal.set(2012, 10, 18); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_OPER_MIR_BWLD1C_20121118T002733_20121118T012104_116_001_1.zip"))); cal.set(2012, 10, 20); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_OPER_MIR_UNCU1A_20121120T010256_20121120T014313_116_001_1.zip"))); cal.set(2005, 0, 1); assertTrue(isSameDay(cal.getTime(), SmosUtils.getSensingStartDayFromFilename("SM_TEST_AUX_MOONT__20050101T000000_20500101T000000_001_001_4.zip"))); }