changeset 2160:d042cba65eab

8012333: javac, ClassFile should have a read(Path) method Reviewed-by: jjg
author vromero
date Tue, 28 May 2013 17:39:41 +0100
parents c6df5b20f9eb
children 92e420e9807d
files src/share/classes/com/sun/tools/classfile/ClassFile.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/classfile/ClassFile.java	Tue May 28 12:46:10 2013 +0100
+++ b/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);