Package com.irurueta.geometry.io
Class MappedFileReaderAndWriterTest
java.lang.Object
com.irurueta.geometry.io.MappedFileReaderAndWriterTest
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intNumber of bytes written into the temporary file used by end of stream tests.(package private) PathTemporary folder where generated files are stored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate FilecreateSparseFile(String name, long length) Creates a sparse file of the given length, skipping the test if the file system does not support it.(package private) voidChecks that reading from a file after its end has been reached returns -1 for every read variant.(package private) voidChecks that an empty pattern is rejected when reading until any of the given characters is found.(package private) voidChecks that skipping a negative number of bytes does not move the position.(package private) void(package private) voidChecks that files exceeding the 2 GB mapping limit are rejected with a clear IOException.(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) voidChecks that skipping a huge number of bytes is bounded by the remaining bytes instead of overflowing.
-
Field Details
-
CONTENT_LENGTH
private static final int CONTENT_LENGTHNumber of bytes written into the temporary file used by end of stream tests.- See Also:
-
tempDir
Temporary folder where generated files are stored.
-
-
Constructor Details
-
MappedFileReaderAndWriterTest
MappedFileReaderAndWriterTest()
-
-
Method Details
-
testConstructor
- Throws:
IOException
-
testReadWriteOneByte
- Throws:
IOException
-
testReadWriteArrayOfBytes
- Throws:
IOException
-
testReadWriteArrayOfBytesWithOffsetAndLength
- Throws:
IOException
-
testSkipAndGetPosition
- Throws:
IOException
-
testSeekAndClose
- Throws:
IOException
-
testReadWriteBoolean
- Throws:
IOException
-
testReadWriteByte
- Throws:
IOException
-
testReadWriteUnsignedByte
- Throws:
IOException
-
testReadWriteShort
- Throws:
IOException
-
testReadWriteShortWithEndianType
- Throws:
IOException
-
testReadWriteUnsignedShort
- Throws:
IOException
-
testReadWriteUnsignedShortWithEndianType
- Throws:
IOException
-
testReadWriteInt
- Throws:
IOException
-
testReadWriteIntWithEndianType
- Throws:
IOException
-
testReadWriteUnsignedInt
- Throws:
IOException
-
testReadWriteUnsignedIntWithEndianType
- Throws:
IOException
-
testReadWriteLong
- Throws:
IOException
-
testReadWriteLongWithEndianType
- Throws:
IOException
-
testReadFloat
- Throws:
IOException
-
testReadWriteFloatWithEndianType
- Throws:
IOException
-
testReadDouble
- Throws:
IOException
-
testReadWriteDoubleWithEndianType
- Throws:
IOException
-
testReadLine
- Throws:
IOException
-
testReadWord
- Throws:
IOException
-
read_whenEndOfStreamReached_returnsMinusOne
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
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 IOExceptionChecks 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
Checks that files exceeding the 2 GB mapping limit are rejected with a clear IOException.- Throws:
IOException- if an I/O error occurs.
-
testSkipWithHugeCount
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
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.
-