From bd240ebfe09b7c7a21689dee8be0cc673eb7f340 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 3 Oct 2014 04:14:10 +0200
Subject: MappedByteBufferInputStream: Default CacheMode is FLUSH_PRE_HARD now
 (was FLUSH_PRE_SOFT)

FLUSH_PRE_SOFT cannot be handled by some platforms, e.g. Windows 32bit.

FLUSH_PRE_HARD is the most reliable caching mode
and it will fallback to FLUSH_PRE_SOFT if no method for 'cleaner' exists.

Further, FLUSH_PRE_HARD turns our to be the fastest mode as well.
---
 .../com/jogamp/common/nio/MappedByteBufferInputStream.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java')

diff --git a/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java b/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java
index 1d4d78a..f8d5857 100644
--- a/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java
+++ b/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java
@@ -82,9 +82,6 @@ public class MappedByteBufferInputStream extends InputStream {
          * while preserving a {@link WeakReference} to allow its resurrection if not yet
          * {@link System#gc() garbage collected}.
          * </p>
-         * <p>
-         * This is the default.
-         * </p>
          */
         FLUSH_PRE_SOFT,
         /**
@@ -96,6 +93,9 @@ public class MappedByteBufferInputStream extends InputStream {
          * using a {@code sun.misc.Cleaner} by reflection.
          * In case such method does not exist nor works, implementation falls back to {@link #FLUSH_PRE_SOFT}.
          * </p>
+         * <p>
+         * This is the default.
+         * </p>
          */
         FLUSH_PRE_HARD
     };
@@ -246,7 +246,7 @@ public class MappedByteBufferInputStream extends InputStream {
      * </p>
      * @param fileChannel the file channel to be mapped lazily.
      * @param mmode the map mode, default is {@link FileChannel.MapMode#READ_ONLY}.
-     * @param cmode the caching mode, default is {@link CacheMode#FLUSH_PRE_SOFT}.
+     * @param cmode the caching mode, default is {@link CacheMode#FLUSH_PRE_HARD}.
      * @param sliceShift the pow2 slice size, default is {@link #DEFAULT_SLICE_SHIFT}.
      * @throws IOException
      */
@@ -265,7 +265,7 @@ public class MappedByteBufferInputStream extends InputStream {
      * </p>
      * @param fileChannel the file channel to be used.
      * @param mmode the map mode, default is {@link FileChannel.MapMode#READ_ONLY}.
-     * @param cmode the caching mode, default is {@link CacheMode#FLUSH_PRE_SOFT}.
+     * @param cmode the caching mode, default is {@link CacheMode#FLUSH_PRE_HARD}.
      * @throws IOException
      */
     public MappedByteBufferInputStream(final FileChannel fileChannel, final FileChannel.MapMode mmode, final CacheMode cmode) throws IOException {
@@ -274,7 +274,7 @@ public class MappedByteBufferInputStream extends InputStream {
 
     /**
      * Creates a new instance using the given {@link FileChannel},
-     * {@link FileChannel.MapMode#READ_ONLY read-only} mapping mode, {@link CacheMode#FLUSH_PRE_SOFT}
+     * {@link FileChannel.MapMode#READ_ONLY read-only} mapping mode, {@link CacheMode#FLUSH_PRE_HARD}
      * and the {@link #DEFAULT_SLICE_SHIFT}.
      * <p>
      * The {@link ByteBuffer} slices will be mapped {@link FileChannel.MapMode#READ_ONLY} lazily at first usage.
@@ -283,7 +283,7 @@ public class MappedByteBufferInputStream extends InputStream {
      * @throws IOException
      */
     public MappedByteBufferInputStream(final FileChannel fileChannel) throws IOException {
-        this(fileChannel, FileChannel.MapMode.READ_ONLY, CacheMode.FLUSH_PRE_SOFT, DEFAULT_SLICE_SHIFT);
+        this(fileChannel, FileChannel.MapMode.READ_ONLY, CacheMode.FLUSH_PRE_HARD, DEFAULT_SLICE_SHIFT);
     }
 
     /**
-- 
cgit v1.2.3