8012333: javac, ClassFile should have a read(Path) method
authorvromero
Tue, 28 May 2013 17:39:41 +0100
changeset 17809 c9d1984367b6
parent 17808 846139633c68
child 17810 db9f3e9cd760
8012333: javac, ClassFile should have a read(Path) method Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java	Tue May 28 12:46:10 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java	Tue May 28 17:39:41 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Path;
 
 import static com.sun.tools.classfile.AccessFlags.*;
 
@@ -46,6 +47,11 @@
         return read(file, new Attribute.Factory());
     }
 
+    public static ClassFile read(Path path)
+            throws IOException, ConstantPoolException {
+        return read(path.toFile(), new Attribute.Factory());
+    }
+
     public static ClassFile read(File file, Attribute.Factory attributeFactory)
             throws IOException, ConstantPoolException {
         FileInputStream in = new FileInputStream(file);