private String advanceLine() { mCurrentLine = mReader.readLine(); return mCurrentLine; }
private String advanceLine() { mCurrentLine = mReader.readLine(); return mCurrentLine; }
private String advanceLine() { mCurrentLine = mReader.readLine(); return mCurrentLine; }
/** * Workhorse method that reads the next line from the underlying reader * * @return String or null if there is no next line */ protected byte[] readNextLine() { try { final String line = reader.readLine(); if (nextLine != null && !isComment(nextLine.getBytes())) { currentLineNumber = nextLineNumber; currentLine = nextLine; } if (line != null) { nextLineNumber++; nextLine = line; return line.getBytes(); } if (!inputs.isEmpty()) { advanceFile(); return readNextLine(); } return null; } catch(RuntimeIOException ioe) { throw new PicardException("Error reading from file " + currentFileName, ioe); } }
/** * Workhorse method that reads the next line from the underlying reader * * @return String or null if there is no next line */ protected byte[] readNextLine() { try { final String line = reader.readLine(); if (nextLine != null && !isComment(nextLine.getBytes())) { currentLineNumber = nextLineNumber; currentLine = nextLine; } if (line != null) { nextLineNumber++; nextLine = line; return line.getBytes(); } if (!inputs.isEmpty()) { advanceFile(); return readNextLine(); } return null; } catch(RuntimeIOException ioe) { throw new PicardException("Error reading from file " + currentFileName, ioe); } }
/** * various test cases where there is no input, except perhaps a line terminator * @param terminator what the terminator should be in the input * @param lastLineTerminated does the input have a terminator */ private void fromStringEmptyTestHelper(final String terminator, final boolean lastLineTerminated) { final String input; if (lastLineTerminated) { input = terminator; } else { input = ""; } final BufferedLineReader blr = BufferedLineReader.fromString(input); blr.peek(); final String output = blr.readLine(); if (lastLineTerminated) { Assert.assertEquals(output, ""); } blr.peek(); Assert.assertNull(blr.readLine()); }
@Test public void testSeek() throws Exception { String expectedLine = "ccccccccc"; File testFile = new File("src/test/resources/htsjdk/samtools/seekablestream/seekTest.txt"); SeekableFileStream is = new SeekableFileStream(testFile); is.seek(20); BufferedLineReader reader = new BufferedLineReader(is); String nextLine = reader.readLine(); Assert.assertEquals(expectedLine, nextLine); reader.close(); } }
lines.add(reader.readLine());