jdk/src/share/classes/java/util/Scanner.java
changeset 8158 77d9c0f1c19f
parent 7966 a23e3f47c5a8
child 8166 13423c0952ad
--- a/jdk/src/share/classes/java/util/Scanner.java	Thu Jan 13 22:21:58 2011 -0800
+++ b/jdk/src/share/classes/java/util/Scanner.java	Fri Jan 28 09:28:43 2011 +0000
@@ -25,7 +25,8 @@
 
 package java.util;
 
-import java.nio.file.FileRef;
+import java.nio.file.Path;
+import java.nio.file.Files;
 import java.util.regex.*;
 import java.io.*;
 import java.math.*;
@@ -699,16 +700,16 @@
      * {@linkplain java.nio.charset.Charset#defaultCharset() default charset}.
      *
      * @param   source
-     *          A file to be scanned
+     *          the path to the file to be scanned
      * @throws  IOException
      *          if an I/O error occurs opening source
      *
      * @since   1.7
      */
-    public Scanner(FileRef source)
+    public Scanner(Path source)
         throws IOException
     {
-        this(source.newInputStream());
+        this(Files.newInputStream(source));
     }
 
     /**
@@ -717,7 +718,7 @@
      * characters using the specified charset.
      *
      * @param   source
-     *          A file to be scanned
+     *          the path to the file to be scanned
      * @param   charsetName
      *          The encoding type used to convert bytes from the file
      *          into characters to be scanned
@@ -727,12 +728,12 @@
      *          if the specified encoding is not found
      * @since   1.7
      */
-    public Scanner(FileRef source, String charsetName) throws IOException {
+    public Scanner(Path source, String charsetName) throws IOException {
         this(Objects.nonNull(source), toCharset(charsetName));
     }
 
-    private Scanner(FileRef source, Charset charset)  throws IOException {
-        this(makeReadable(source.newInputStream(), charset));
+    private Scanner(Path source, Charset charset)  throws IOException {
+        this(makeReadable(Files.newInputStream(source), charset));
     }
 
     /**