Package gov.nasa.pds.objectAccess
Class ByteWiseFileAccessorReadBytesTest
java.lang.Object
gov.nasa.pds.objectAccess.ByteWiseFileAccessorReadBytesTest
Tests for ByteWiseFileAccessor.readBytes() — the new bulk-read method added by the
buffered-read performance PR. Each test targets a specific edge case identified
during review.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDemonstrates that after readBytes() pre-reads N bytes, a subsequent readByte() call skips those already-buffered bytes — they share curPosition.voidvoidvoid\r is the last byte of an 8192-byte buffer fill; \n is the first byte of the next fill.voidOld readByte() returned a signed byte widened to int: 0xFF -> -1 -> hit case -1 (EOF).
-
Constructor Details
-
ByteWiseFileAccessorReadBytesTest
public ByteWiseFileAccessorReadBytesTest()
-
-
Method Details
-
testReadBytes_crLfStraddlesBoundary
\r is the last byte of an 8192-byte buffer fill; \n is the first byte of the next fill. readBytes() must return both bytes correctly across the boundary.- Throws:
Exception
-
testReadBytes_bareCrAtBoundary
- Throws:
Exception
-
testReadBytes_crAtEof
- Throws:
Exception
-
testReadBytes_ffByteIsNotEof
Old readByte() returned a signed byte widened to int: 0xFF -> -1 -> hit case -1 (EOF). New readBytes() copies raw bytes; 0xFF must appear in the output unchanged. This test verifies the NEW behavior of readBytes(). Before merging to upstream, confirm that no existing PDS4 archive product relies on the OLD 0xFF-as-EOF behavior.- Throws:
Exception
-
testReadBytes_advancesCurPosition
Demonstrates that after readBytes() pre-reads N bytes, a subsequent readByte() call skips those already-buffered bytes — they share curPosition. In RawTableReader this is safe because readNextLine() is never mixed with readByte() on the same accessor instance. This test documents that contract.- Throws:
Exception
-