Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4462336

Merlin:java.nio.MappedByteBuffer.isReadOnly() wrong

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      x86
    • OS:
      windows_2000
    • Verification:
      Verified

      Description


      ingrid.yao@Eng 2001-05-23

      J2SE Version (please include all output from java -version flag):

         java version "1.4.0-beta"
         Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b64)
         Java HotSpot(TM) Client VM (build 1.4.0-beta-b64, mixed mode)

      Does this problem occur on J2SE 1.3? Yes / No (pick one)

         Feature Not exists

      Operating System Configuration Information (be specific):

           Win 2000 5.00.2195 Service pack 1

      Hardware Configuration Information (be specific):

          x86 Family 6 Model 7 Stepping 3

      Bug Description:

          java.nio.MappedByteBuffer.isReadOnly() returns false, should be true

      Test program
      ================

      import java.nio.channels.FileChannel;
      import java.nio.MappedByteBuffer;
      import java.io.*;


      public class readNIOSmap {

         public static void main(String[] args) throws Exception {
      readNIOSmap();
         }

         private static void readNIOSmap() throws IOException {
           long startTime = System.currentTimeMillis();

           RandomAccessFile raf = new RandomAccessFile("testFile", "r");
           FileChannel channel = raf.getChannel();
           MappedByteBuffer buff = channel.map(FileChannel.MAP_RO, 0, (int) raf.length());
           buff.load();
           System.out.println(" read NIO map: "+ buff.isDirect()+" "+buff.isLoaded()+" "+ buff.isReadOnly());

           raf.close();

           long tookTime = System.currentTimeMillis() - startTime;
           System.out.println("Read NIO Stream mapped takes "+ (tookTime*.001) + " seconds");
         }
      }

        Attachments

          Activity

            People

            • Assignee:
              mmcclosksunw Michael Mccloskey (Inactive)
              Reporter:
              tyao Ting-Yun Ingrid Yao (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: