gpt4 book ai didi

java - 如果在执行 FileChannel.map() 时 MappedByteBuffer 的大小大于文件长度,会发生什么

转载 作者:太空宇宙 更新时间:2023-11-04 08:10:41 25 4
gpt4 key购买 nike

我正在尝试将随机访问文件映射到内存,然后想要附加一些数据。 MappedByteBuffer buffer = file.getChannel().map(MapMode.READ_WRITE, 0, size);

如果 size > file.length 会发生什么?

最佳答案

这个问题的答案在 Javadoc 中:

The behavior of this method when the requested region is not completely contained within this channel's file is unspecified.

关于java - 如果在执行 FileChannel.map() 时 MappedByteBuffer 的大小大于文件长度,会发生什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11271546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com