JDK-8221696 : (bf) MappedByteBuffer.force method to specify range
Type:Enhancement
Component:core-libs
Sub-Component:java.nio
Affected Version:13
Priority:P4
Status:Resolved
Resolution:Fixed
Submitted:2019-03-29
Updated:2021-03-17
Resolved:2019-05-13
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Overload MappedByteBuffer.force to accept index and length arguments
Comments
This patch requires the following changes
1) Overload the `MappedByteBuffer::force` method
public final MappedByteBuffer force(int index, int length);
A call to this method ensures that modifications to buffer data in the range starting at `index` and up to (but not necessarily including) `index + length` are written back to the underlying storage medium for the buffer. There is no guarantee that bytes outside that range are not also written back.
An `IndexOutOfBoundsException` will be thrown if the subregion defined by `index` and `length` is not contained in the initial segment of the buffer region from index `0` up to but not including the current buffer limit.