DelimitedInputFormat extends FileInputFormat<OT> { @Override public void open(FileInputSplit split) throws IOException { super.open(split); this.bufferSize = this.bufferSize <= 0 ? DEFAULT_READ_BUFFER_SIZE : this.bufferSize; if (this.readBuffer == null || this.readBuffer.length != this.bufferSize) { this.readBuffer = new byte[this.bufferSize]; } if (this.wrapBuffer == null || this.wrapBuffer.length < 256) { this.wrapBuffer = new byte[256]; } this.readPos = 0; this.limit = 0; this.overLimit = false; this.end = false; if (this.splitStart != 0) { this.stream.seek(this.splitStart); readLine(); if (this.overLimit) { this.end = true; } } else { fillBuffer(); } } DelimitedInputFormat(); protected  DelimitedInputFormat(Path filePath); byte[] getDelimiter(); void setDelimiter(byte[] delimiter); void setDelimiter(char delimiter); void setDelimiter(String delimiter); int getLineLengthLimit(); void setLineLengthLimit(int lineLengthLimit); int getBufferSize(); void setBufferSize(int bufferSize); int getNumLineSamples(); void setNumLineSamples(int numLineSamples); abstract OT readRecord(OT reuse, byte[] bytes, int offset, int numBytes); @Override void configure(Configuration parameters); @Override FileBaseStatistics getStatistics(BaseStatistics cachedStats); @Override void open(FileInputSplit split); @Override boolean reachedEnd(); @Override OT nextRecord(OT record); @Override void close();  }
@Test public void testOpen() throws IOException { final String myString = "my mocked line 1\nmy mocked line 2\n"; final FileInputSplit split = createTempFile(myString); int bufferSize = 5; format.setBufferSize(bufferSize); format.open(split); assertEquals(0, format.splitStart); assertEquals(myString.length() - bufferSize, format.splitLength); assertEquals(bufferSize, format.getBufferSize()); }