src/java.base/share/classes/java/nio/MappedByteBuffer.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke


   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.nio;
  27 
  28 import java.io.FileDescriptor;
  29 import sun.misc.Unsafe;
  30 
  31 
  32 /**
  33  * A direct byte buffer whose content is a memory-mapped region of a file.
  34  *
  35  * <p> Mapped byte buffers are created via the {@link
  36  * java.nio.channels.FileChannel#map FileChannel.map} method.  This class
  37  * extends the {@link ByteBuffer} class with operations that are specific to
  38  * memory-mapped file regions.
  39  *
  40  * <p> A mapped byte buffer and the file mapping that it represents remain
  41  * valid until the buffer itself is garbage-collected.
  42  *
  43  * <p> The content of a mapped byte buffer can change at any time, for example
  44  * if the content of the corresponding region of the mapped file is changed by
  45  * this program or another.  Whether or not such changes occur, and when they
  46  * occur, is operating-system dependent and therefore unspecified.
  47  *
  48  * <a name="inaccess"></a><p> All or part of a mapped byte buffer may become
  49  * inaccessible at any time, for example if the mapped file is truncated.  An




   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.nio;
  27 
  28 import java.io.FileDescriptor;
  29 import jdk.internal.misc.Unsafe;
  30 
  31 
  32 /**
  33  * A direct byte buffer whose content is a memory-mapped region of a file.
  34  *
  35  * <p> Mapped byte buffers are created via the {@link
  36  * java.nio.channels.FileChannel#map FileChannel.map} method.  This class
  37  * extends the {@link ByteBuffer} class with operations that are specific to
  38  * memory-mapped file regions.
  39  *
  40  * <p> A mapped byte buffer and the file mapping that it represents remain
  41  * valid until the buffer itself is garbage-collected.
  42  *
  43  * <p> The content of a mapped byte buffer can change at any time, for example
  44  * if the content of the corresponding region of the mapped file is changed by
  45  * this program or another.  Whether or not such changes occur, and when they
  46  * occur, is operating-system dependent and therefore unspecified.
  47  *
  48  * <a name="inaccess"></a><p> All or part of a mapped byte buffer may become
  49  * inaccessible at any time, for example if the mapped file is truncated.  An