Class MappedFileReaderAndWriterTest

java.lang.Object
com.irurueta.geometry.io.MappedFileReaderAndWriterTest

class MappedFileReaderAndWriterTest extends Object
  • Field Details

    • CONTENT_LENGTH

      private static final int CONTENT_LENGTH
      Number of bytes written into the temporary file used by end of stream tests.
      See Also:
    • tempDir

      @TempDir Path tempDir
      Temporary folder where generated files are stored.
  • Constructor Details

    • MappedFileReaderAndWriterTest

      MappedFileReaderAndWriterTest()
  • Method Details

    • testConstructor

      @Test void testConstructor() throws IOException
      Throws:
      IOException
    • testReadWriteOneByte

      @Test void testReadWriteOneByte() throws IOException
      Throws:
      IOException
    • testReadWriteArrayOfBytes

      @Test void testReadWriteArrayOfBytes() throws IOException
      Throws:
      IOException
    • testReadWriteArrayOfBytesWithOffsetAndLength

      @Test void testReadWriteArrayOfBytesWithOffsetAndLength() throws IOException
      Throws:
      IOException
    • testSkipAndGetPosition

      @Test void testSkipAndGetPosition() throws IOException
      Throws:
      IOException
    • testSeekAndClose

      @Test void testSeekAndClose() throws IOException
      Throws:
      IOException
    • testReadWriteBoolean

      @Test void testReadWriteBoolean() throws IOException
      Throws:
      IOException
    • testReadWriteByte

      @Test void testReadWriteByte() throws IOException
      Throws:
      IOException
    • testReadWriteUnsignedByte

      @Test void testReadWriteUnsignedByte() throws IOException
      Throws:
      IOException
    • testReadWriteShort

      @Test void testReadWriteShort() throws IOException
      Throws:
      IOException
    • testReadWriteShortWithEndianType

      @Test void testReadWriteShortWithEndianType() throws IOException
      Throws:
      IOException
    • testReadWriteUnsignedShort

      @Test void testReadWriteUnsignedShort() throws IOException
      Throws:
      IOException
    • testReadWriteUnsignedShortWithEndianType

      @Test void testReadWriteUnsignedShortWithEndianType() throws IOException
      Throws:
      IOException
    • testReadWriteInt

      @Test void testReadWriteInt() throws IOException
      Throws:
      IOException
    • testReadWriteIntWithEndianType

      @Test void testReadWriteIntWithEndianType() throws IOException
      Throws:
      IOException
    • testReadWriteUnsignedInt

      @Test void testReadWriteUnsignedInt() throws IOException
      Throws:
      IOException
    • testReadWriteUnsignedIntWithEndianType

      @Test void testReadWriteUnsignedIntWithEndianType() throws IOException
      Throws:
      IOException
    • testReadWriteLong

      @Test void testReadWriteLong() throws IOException
      Throws:
      IOException
    • testReadWriteLongWithEndianType

      @Test void testReadWriteLongWithEndianType() throws IOException
      Throws:
      IOException
    • testReadFloat

      @Test void testReadFloat() throws IOException
      Throws:
      IOException
    • testReadWriteFloatWithEndianType

      @Test void testReadWriteFloatWithEndianType() throws IOException
      Throws:
      IOException
    • testReadDouble

      @Test void testReadDouble() throws IOException
      Throws:
      IOException
    • testReadWriteDoubleWithEndianType

      @Test void testReadWriteDoubleWithEndianType() throws IOException
      Throws:
      IOException
    • testReadLine

      @Test void testReadLine() throws IOException
      Throws:
      IOException
    • testReadWord

      @Test void testReadWord() throws IOException
      Throws:
      IOException
    • read_whenEndOfStreamReached_returnsMinusOne

      @Test void read_whenEndOfStreamReached_returnsMinusOne() throws IOException
      Checks that reading from a file after its end has been reached returns -1 for every read variant.
      Throws:
      IOException - if an I/O error occurs.
    • skip_whenNegative_returnsZero

      @Test void skip_whenNegative_returnsZero() throws IOException
      Checks that skipping a negative number of bytes does not move the position.
      Throws:
      IOException - if an I/O error occurs.
    • readUntilAnyOfTheseCharactersIsFound_whenEmptyPattern_throwsIllegalArgumentException

      @Test void readUntilAnyOfTheseCharactersIsFound_whenEmptyPattern_throwsIllegalArgumentException() throws IOException
      Checks that an empty pattern is rejected when reading until any of the given characters is found.
      Throws:
      IOException - if an I/O error occurs.
    • testConstructorWhenFileExceedsMappingLimit_throwsIOException

      @Test void testConstructorWhenFileExceedsMappingLimit_throwsIOException() throws IOException
      Checks that files exceeding the 2 GB mapping limit are rejected with a clear IOException.
      Throws:
      IOException - if an I/O error occurs.
    • testSkipWithHugeCount

      @Test void testSkipWithHugeCount() throws IOException
      Checks that skipping a huge number of bytes is bounded by the remaining bytes instead of overflowing.
      Throws:
      IOException - if an I/O error occurs.
    • createSparseFile

      private File createSparseFile(String name, long length) throws IOException
      Creates a sparse file of the given length, skipping the test if the file system does not support it.
      Parameters:
      name - file name.
      length - file length.
      Returns:
      created file.
      Throws:
      IOException - if an I/O error occurs.