@Test public void testParseMultipleLines() throws FastLdrException { String[] filePaths = ParFileParser.parse(new ByteArrayInputStream("CONTROL=/home/a/b\nCONTROL=/home/c/d\n" .getBytes())); assertEquals(2, filePaths.length); assertEquals("/home/a/b", filePaths[0]); assertEquals("/home/c/d", filePaths[1]); }
public static String[] parse(InputStream inputStream) throws FastLdrException { List<String> files = new ArrayList<String>(); try { BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith("CONTROL")) { files.add(getSubstring(line)); } } } catch (FileNotFoundException e) { throw new FastLdrException(e); } catch (IOException e) { throw new FastLdrException(e); } return files.toArray(new String[files.size()]); }
ParFileParser { public static String[] parse(InputStream inputStream) throws FastLdrException { List<String> files = new ArrayList<String>(); try { BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith("CONTROL")) { files.add(getSubstring(line)); } } } catch (FileNotFoundException e) { throw new FastLdrException(e); } catch (IOException e) { throw new FastLdrException(e); } return files.toArray(new String[files.size()]); } }
ParFileParser { public static String[] parse(InputStream inputStream) throws FastLdrException { List<String> files = new ArrayList<String>(); try { BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith("CONTROL")) { files.add(getSubstring(line)); } } } catch (FileNotFoundException e) { throw new FastLdrException(e); } catch (IOException e) { throw new FastLdrException(e); } return files.toArray(new String[files.size()]); }  }
ParFileParser { public static String[] parse(InputStream inputStream) throws FastLdrException { List<String> files = new ArrayList<String>(); try { BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith("CONTROL")) { files.add(getSubstring(line)); } } } catch (FileNotFoundException e) { throw new FastLdrException(e); } catch (IOException e) { throw new FastLdrException(e); } return files.toArray(new String[files.size()]); }  static String[] parse(InputStream inputStream); }
ParFileParser { public static String[] parse(InputStream inputStream) throws FastLdrException { List<String> files = new ArrayList<String>(); try { BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith("CONTROL")) { files.add(getSubstring(line)); } } } catch (FileNotFoundException e) { throw new FastLdrException(e); } catch (IOException e) { throw new FastLdrException(e); } return files.toArray(new String[files.size()]); }  static String[] parse(InputStream inputStream);  }