CSR :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
If two MappedByteBuffers are created by mapping overlapping ranges of the same file, then copying between these buffers may yield unexpected results. For example, in the attached class MappedOverlapCopy, the middle half of a file is mapped to one buffer which then puts its contents into another buffer which is mapped from the second half of the file. The third and fourth quarters of the file then end up each being equal to the second quarter of the original file contents. This is different for example from the behavior of System.arraycopy() which for overlapping contents behaves as if the source data were first copied into a separate, temporary location and then copied to the destination location. If such behavior were to obtain for MappedByteBuffer, then the result of the example would be that the upper half of the file contents would end up being equal to the middle half of the original file contents. The documentation of MappedByteBuffer should be updated to clarify that the outcome of such overlapped copying is unspecified.
|