Package gov.nasa.pds.objectAccess
Class RawTableReaderBufferedReadTest
java.lang.Object
gov.nasa.pds.objectAccess.RawTableReaderBufferedReadTest
Tests for the buffered readNextLine() implementation in RawTableReader,
focusing on line-ending edge cases at the internal buffer boundary (8192 bytes).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()voidTests a bare \\r at the exact buffer boundary (byte 8191), followed by a non-\\n character.voidTests a \\r at the exact buffer boundary where the file ends immediately after (EOF after \\r).voidTests that a \\r\\n line ending that straddles the 8192-byte buffer boundary is correctly handled: \\r at byte 8191 (last byte of first buffer fill), \\n at byte 8192 (first byte of second buffer fill).voidTests that an empty file causes an InvalidTableException during construction, since ByteWiseFileAccessor rejects files that are smaller than the declared table size.voidTests that a 0xFF byte mid-line is treated as data, not as EOF.voidTests a \\n at the exact start of the second buffer fill (byte 8192), preceded by content that fills the first buffer completely without a newline, then has \\n as the first byte of the refill.voidTests basic multi-line reading with \\r\\n, \\n, and \\r delimiters all within a single buffer fill (no boundary issues).
-
Constructor Details
-
RawTableReaderBufferedReadTest
public RawTableReaderBufferedReadTest()
-
-
Method Details
-
cleanup
@AfterMethod public void cleanup() -
testCrLfAtBufferBoundary
Tests that a \\r\\n line ending that straddles the 8192-byte buffer boundary is correctly handled: \\r at byte 8191 (last byte of first buffer fill), \\n at byte 8192 (first byte of second buffer fill).- Throws:
Exception
-
testBareCrAtBufferBoundary
Tests a bare \\r at the exact buffer boundary (byte 8191), followed by a non-\\n character. The \\r should end the line and the next character should appear in the following line.- Throws:
Exception
-
testCrAtBufferBoundaryFollowedByEof
Tests a \\r at the exact buffer boundary where the file ends immediately after (EOF after \\r). The line should contain the \\r and then EOF.- Throws:
Exception
-
testLfAtStartOfSecondBuffer
Tests a \\n at the exact start of the second buffer fill (byte 8192), preceded by content that fills the first buffer completely without a newline, then has \\n as the first byte of the refill.- Throws:
Exception
-
testMixedLineEndings
Tests basic multi-line reading with \\r\\n, \\n, and \\r delimiters all within a single buffer fill (no boundary issues).- Throws:
Exception
-
testEmptyFile
Tests that an empty file causes an InvalidTableException during construction, since ByteWiseFileAccessor rejects files that are smaller than the declared table size.- Throws:
Exception
-
testFfBytePassesThroughReadNextLine
Tests that a 0xFF byte mid-line is treated as data, not as EOF. Old behavior (readByte()-based): 0xFF sign-extended to int -1, hit case -1, truncated line. New behavior (readBytes()-based): 0xFF passes through as raw data and is decoded by UTF-8 as the replacement character U+FFFD. The line is NOT truncated. See NASA-PDS/pds4-jparser#197 for the upstream tracking note.- Throws:
Exception
-