@Test public void testExtractValueForKeyHandlesStupidInput() { try { ModisUtils.extractValueForKey(null, "DAYNIGHTFLAG"); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException ignored) { } try { ModisUtils.extractValueForKey(TestCoreString, null); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException ignored) { } }
public static String extractValueForKey(String metaDataString, String key) { Guardian.assertNotNull("metaDataString", metaDataString); Guardian.assertNotNull("key", key); int pos = metaDataString.indexOf(key); if (pos >= 0) { pos = metaDataString.indexOf("VALUE", pos); if (pos >= 0) { pos = metaDataString.indexOf('=', pos); if (pos >= 0) { int endPos = metaDataString.indexOf('\n', pos + 1); if (endPos >= 0) { String value = metaDataString.substring(pos + 1, endPos); value = value.replace('"', ' '); return value.trim(); } } } } return null; }
ModisUtils { public static String extractValueForKey(String metaDataString, String key) { Guardian.assertNotNull("metaDataString", metaDataString); Guardian.assertNotNull("key", key); int pos = metaDataString.indexOf(key); if (pos >= 0) { pos = metaDataString.indexOf("VALUE", pos); if (pos >= 0) { pos = metaDataString.indexOf('=', pos); if (pos >= 0) { int endPos = metaDataString.indexOf('\n', pos + 1); if (endPos >= 0) { String value = metaDataString.substring(pos + 1, endPos); value = value.replace('"', ' '); return value.trim(); } } } } return null; } }
ModisUtils { public static String extractValueForKey(String metaDataString, String key) { Guardian.assertNotNull("metaDataString", metaDataString); Guardian.assertNotNull("key", key); int pos = metaDataString.indexOf(key); if (pos >= 0) { pos = metaDataString.indexOf("VALUE", pos); if (pos >= 0) { pos = metaDataString.indexOf('=', pos); if (pos >= 0) { int endPos = metaDataString.indexOf('\n', pos + 1); if (endPos >= 0) { String value = metaDataString.substring(pos + 1, endPos); value = value.replace('"', ' '); return value.trim(); } } } } return null; }  }
ModisUtils { public static String extractValueForKey(String metaDataString, String key) { Guardian.assertNotNull("metaDataString", metaDataString); Guardian.assertNotNull("key", key); int pos = metaDataString.indexOf(key); if (pos >= 0) { pos = metaDataString.indexOf("VALUE", pos); if (pos >= 0) { pos = metaDataString.indexOf('=', pos); if (pos >= 0) { int endPos = metaDataString.indexOf('\n', pos + 1); if (endPos >= 0) { String value = metaDataString.substring(pos + 1, endPos); value = value.replace('"', ' '); return value.trim(); } } } } return null; }  static String decodeBandName(String names, int layerIdx); static float[] decodeSpectralInformation(String bandExt, float[] recycle); static String extractValueForKey(String metaDataString, String key); static Date createDateFromStrings(final String date, final String time); static IncrementOffset getIncrementOffset(String attribute); static Range getRangeFromString(String rangeString); static String extractBandName(String variableName); }
ModisUtils { public static String extractValueForKey(String metaDataString, String key) { Guardian.assertNotNull("metaDataString", metaDataString); Guardian.assertNotNull("key", key); int pos = metaDataString.indexOf(key); if (pos >= 0) { pos = metaDataString.indexOf("VALUE", pos); if (pos >= 0) { pos = metaDataString.indexOf('=', pos); if (pos >= 0) { int endPos = metaDataString.indexOf('\n', pos + 1); if (endPos >= 0) { String value = metaDataString.substring(pos + 1, endPos); value = value.replace('"', ' '); return value.trim(); } } } } return null; }  static String decodeBandName(String names, int layerIdx); static float[] decodeSpectralInformation(String bandExt, float[] recycle); static String extractValueForKey(String metaDataString, String key); static Date createDateFromStrings(final String date, final String time); static IncrementOffset getIncrementOffset(String attribute); static Range getRangeFromString(String rangeString); static String extractBandName(String variableName);  }