Class RawTableReaderBufferedReadTest

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

public class RawTableReaderBufferedReadTest extends Object
Tests for the buffered readNextLine() implementation in RawTableReader, focusing on line-ending edge cases at the internal buffer boundary (8192 bytes).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    Tests a bare \\r at the exact buffer boundary (byte 8191), followed by a non-\\n character.
    void
    Tests a \\r at the exact buffer boundary where the file ends immediately after (EOF after \\r).
    void
    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).
    void
    Tests that an empty file causes an InvalidTableException during construction, since ByteWiseFileAccessor rejects files that are smaller than the declared table size.
    void
    Tests that a 0xFF byte mid-line is treated as data, not as EOF.
    void
    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.
    void
    Tests basic multi-line reading with \\r\\n, \\n, and \\r delimiters all within a single buffer fill (no boundary issues).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RawTableReaderBufferedReadTest

      public RawTableReaderBufferedReadTest()
  • Method Details

    • cleanup

      @AfterMethod public void cleanup()
    • testCrLfAtBufferBoundary

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

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

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

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

      public void testMixedLineEndings() throws Exception
      Tests basic multi-line reading with \\r\\n, \\n, and \\r delimiters all within a single buffer fill (no boundary issues).
      Throws:
      Exception
    • testEmptyFile

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

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