@Test public void testIsMetadataFile() throws Exception { InputStream positiveFile1 = getClass().getResourceAsStream("test_L8_MTL.txt"); assertTrue(LandsatGeotiffReaderPlugin.isMetadataFile(positiveFile1)); InputStream positiveFile2 = getClass().getResourceAsStream("test_legacy_L5_WithTrailingWhiteSpace_MTL.txt"); assertTrue(LandsatGeotiffReaderPlugin.isMetadataFile(positiveFile2)); }
static boolean isMetadataFile(InputStream inputStream) { String firstLine; try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { firstLine = reader.readLine(); } catch (IOException e) { return false; } return firstLine != null && firstLine.trim().matches("GROUP = L1_METADATA_FILE"); }
LandsatGeotiffReaderPlugin implements ProductReaderPlugIn { static boolean isMetadataFile(InputStream inputStream) { String firstLine; try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { firstLine = reader.readLine(); } catch (IOException e) { return false; } return firstLine != null && firstLine.trim().matches("GROUP = L1_METADATA_FILE"); } }
LandsatGeotiffReaderPlugin implements ProductReaderPlugIn { static boolean isMetadataFile(InputStream inputStream) { String firstLine; try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { firstLine = reader.readLine(); } catch (IOException e) { return false; } return firstLine != null && firstLine.trim().matches("GROUP = L1_METADATA_FILE"); }  }
LandsatGeotiffReaderPlugin implements ProductReaderPlugIn { static boolean isMetadataFile(InputStream inputStream) { String firstLine; try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { firstLine = reader.readLine(); } catch (IOException e) { return false; } return firstLine != null && firstLine.trim().matches("GROUP = L1_METADATA_FILE"); }  @Override DecodeQualification getDecodeQualification(Object input); @Override Class[] getInputTypes(); @Override ProductReader createReaderInstance(); @Override String[] getFormatNames(); @Override String[] getDefaultFileExtensions(); @Override String getDescription(Locale locale); @Override SnapFileFilter getProductFileFilter(); }
LandsatGeotiffReaderPlugin implements ProductReaderPlugIn { static boolean isMetadataFile(InputStream inputStream) { String firstLine; try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { firstLine = reader.readLine(); } catch (IOException e) { return false; } return firstLine != null && firstLine.trim().matches("GROUP = L1_METADATA_FILE"); }  @Override DecodeQualification getDecodeQualification(Object input); @Override Class[] getInputTypes(); @Override ProductReader createReaderInstance(); @Override String[] getFormatNames(); @Override String[] getDefaultFileExtensions(); @Override String getDescription(Locale locale); @Override SnapFileFilter getProductFileFilter();  }