< prev index next >

src/java.base/share/classes/java/io/FileInputStream.java

Print this page
@@ -25,11 +25,10 @@
  
  package java.io;
  
  import java.nio.channels.FileChannel;
  import java.util.Arrays;
- import jdk.internal.misc.Blocker;
  import jdk.internal.util.ArraysSupport;
  import sun.nio.ch.FileChannelImpl;
  
  /**
   * A {@code FileInputStream} obtains input bytes

@@ -208,16 +207,11 @@
      /**
       * Opens the specified file for reading.
       * @param name the name of the file
       */
      private void open(String name) throws FileNotFoundException {
-         long comp = Blocker.begin();
-         try {
-             open0(name);
-         } finally {
-             Blocker.end(comp);
-         }
+         open0(name);
      }
  
      /**
       * Reads a byte of data from this input stream. This method blocks
       * if no input is yet available.

@@ -226,16 +220,11 @@
       *             file is reached.
       * @throws     IOException {@inheritDoc}
       */
      @Override
      public int read() throws IOException {
-         long comp = Blocker.begin();
-         try {
-             return read0();
-         } finally {
-             Blocker.end(comp);
-         }
+         return read0();
      }
  
      private native int read0() throws IOException;
  
      /**

@@ -258,16 +247,11 @@
       *             the file has been reached.
       * @throws     IOException  if an I/O error occurs.
       */
      @Override
      public int read(byte[] b) throws IOException {
-         long comp = Blocker.begin();
-         try {
-             return readBytes(b, 0, b.length);
-         } finally {
-             Blocker.end(comp);
-         }
+         return readBytes(b, 0, b.length);
      }
  
      /**
       * Reads up to {@code len} bytes of data from this input stream
       * into an array of bytes. If {@code len} is not zero, the method

@@ -282,16 +266,11 @@
       * @throws     IndexOutOfBoundsException {@inheritDoc}
       * @throws     IOException  if an I/O error occurs.
       */
      @Override
      public int read(byte[] b, int off, int len) throws IOException {
-         long comp = Blocker.begin();
-         try {
-             return readBytes(b, off, len);
-         } finally {
-             Blocker.end(comp);
-         }
+         return readBytes(b, off, len);
      }
  
      @Override
      public byte[] readAllBytes() throws IOException {
          long length = length();

@@ -394,26 +373,16 @@
              return Long.MAX_VALUE;
          }
      }
  
      private long length() throws IOException {
-         long comp = Blocker.begin();
-         try {
-             return length0();
-         } finally {
-             Blocker.end(comp);
-         }
+         return length0();
      }
      private native long length0() throws IOException;
  
      private long position() throws IOException {
-         long comp = Blocker.begin();
-         try {
-             return position0();
-         } finally {
-             Blocker.end(comp);
-         }
+         return position0();
      }
      private native long position0() throws IOException;
  
      /**
       * Skips over and discards {@code n} bytes of data from the

@@ -439,16 +408,11 @@
       * @throws     IOException  if n is negative, if the stream does not
       *             support seek, or if an I/O error occurs.
       */
      @Override
      public long skip(long n) throws IOException {
-         long comp = Blocker.begin();
-         try {
-             return skip0(n);
-         } finally {
-             Blocker.end(comp);
-         }
+         return skip0(n);
      }
  
      private native long skip0(long n) throws IOException;
  
      /**

@@ -468,16 +432,11 @@
       * @throws     IOException  if this file input stream has been closed by calling
       *             {@code close} or an I/O error occurs.
       */
      @Override
      public int available() throws IOException {
-         long comp = Blocker.begin();
-         try {
-             return available0();
-         } finally {
-             Blocker.end(comp);
-         }
+         return available0();
      }
  
      private native int available0() throws IOException;
  
      /**

@@ -564,12 +523,12 @@
          FileChannel fc = this.channel;
          if (fc == null) {
              synchronized (this) {
                  fc = this.channel;
                  if (fc == null) {
-                     this.channel = fc = FileChannelImpl.open(fd, path, true,
-                         false, false, this);
+                     fc = FileChannelImpl.open(fd, path, true, false, false, false, this);
+                     this.channel = fc;
                      if (closed) {
                          try {
                              // possible race with close(), benign since
                              // FileChannel.close is final and idempotent
                              fc.close();
< prev index next >