Class ByteWiseFileAccessorReadBytesTest

java.lang.Object
gov.nasa.pds.objectAccess.ByteWiseFileAccessorReadBytesTest

public class ByteWiseFileAccessorReadBytesTest extends Object
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 Details

    • ByteWiseFileAccessorReadBytesTest

      public ByteWiseFileAccessorReadBytesTest()
  • Method Details

    • testReadBytes_crLfStraddlesBoundary

      public void testReadBytes_crLfStraddlesBoundary() throws Exception
      \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

      public void testReadBytes_bareCrAtBoundary() throws Exception
      Throws:
      Exception
    • testReadBytes_crAtEof

      public void testReadBytes_crAtEof() throws Exception
      Throws:
      Exception
    • testReadBytes_ffByteIsNotEof

      public void testReadBytes_ffByteIsNotEof() throws Exception
      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

      public void testReadBytes_advancesCurPosition() throws Exception
      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