/** Returns all of the untrimmed lines in the provided file. */ public static List<String> slurpLines(final File file) throws FileNotFoundException { return slurpLines(new FileInputStream(file)); }
/** Returns all of the untrimmed lines in the provided file. */ public static List<String> slurpLines(final File file) throws FileNotFoundException { return slurpLines(new FileInputStream(file)); }
/** Returns all of the untrimmed lines in the provided file. */ public static List<String> slurpLines(final File file) throws FileNotFoundException { return slurpLines(new FileInputStream(file)); }
@Test public void slurpLinesTest() throws FileNotFoundException { Assert.assertEquals(IOUtil.slurpLines(SLURP_TEST_FILE.toFile()), SLURP_TEST_LINES); }
for (final String line : IOUtil.slurpLines(this.ALT_NAMES)) { if (StringUtil.isBlank(line)) { continue;
for (final String line : IOUtil.slurpLines(this.ALT_NAMES)) { if (StringUtil.isBlank(line)) { continue;
private void assertFilesEqualSkipHeaders(File tempFile, File f1) throws FileNotFoundException { final List<String> lines1 = IOUtil.slurpLines(f1); final List<String> lines2 = IOUtil.slurpLines(tempFile); final int firstNonComment1 = IntStream.range(0, lines1.size()).filter(i -> !lines1.get(i).startsWith("#")).findFirst().getAsInt(); final int firstNonComment2 = IntStream.range(0, lines2.size()).filter(i -> !lines2.get(i).startsWith("#")).findFirst().getAsInt(); Assert.assertEquals(lines1.subList(firstNonComment1, lines1.size()), lines2.subList(firstNonComment2,lines2.size())); } }
@Test public void testConvertToBed() throws Exception { final IntervalListToBed program = new IntervalListToBed(); final File tmp = File.createTempFile("interval_list_to_bed_test_output", ".bed"); tmp.deleteOnExit(); final String[] args = { "INPUT=" + INTERVAL_LIST.getAbsolutePath(), "OUTPUT=" + tmp.getAbsolutePath(), "SCORE=333" }; program.instanceMain(args); final List<String> expected = IOUtil.slurpLines(BED_FILE); final List<String> actual = IOUtil.slurpLines(tmp); // Make sure we got the same number of entries! Assert.assertEquals(actual.size(), expected.size()); // Then make sure the entries are the same. for (int i=0; i<expected.size(); ++i) { Assert.assertEquals(actual.get(i), expected.get(i)); } }