code: @SuppressWarnings("resource")
      public static FileChannel openChannel(File file, boolean mutable) throws IOException {
          if (mutable) {
              return new RandomAccessFile(file, "rw").getChannel();
          }
          return new FileInputStream(file).getChannel();
      }
docs: open a readable or writeable FileChannel
  
  @param file    file object
  @param mutable writeable
  @return open the FileChannel
  @throws IOException any io exception