8012333: javac, ClassFile should have a read(Path) method

Tue, 28 May 2013 17:39:41 +0100

author
vromero
date
Tue, 28 May 2013 17:39:41 +0100
changeset 1784
d042cba65eab
parent 1783
c6df5b20f9eb
child 1785
92e420e9807d

8012333: javac, ClassFile should have a read(Path) method
Reviewed-by: jjg

src/share/classes/com/sun/tools/classfile/ClassFile.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/classfile/ClassFile.java	Tue May 28 12:46:10 2013 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/classfile/ClassFile.java	Tue May 28 17:39:41 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -29,6 +29,7 @@
    1.11  import java.io.FileInputStream;
    1.12  import java.io.IOException;
    1.13  import java.io.InputStream;
    1.14 +import java.nio.file.Path;
    1.15  
    1.16  import static com.sun.tools.classfile.AccessFlags.*;
    1.17  
    1.18 @@ -46,6 +47,11 @@
    1.19          return read(file, new Attribute.Factory());
    1.20      }
    1.21  
    1.22 +    public static ClassFile read(Path path)
    1.23 +            throws IOException, ConstantPoolException {
    1.24 +        return read(path.toFile(), new Attribute.Factory());
    1.25 +    }
    1.26 +
    1.27      public static ClassFile read(File file, Attribute.Factory attributeFactory)
    1.28              throws IOException, ConstantPoolException {
    1.29          FileInputStream in = new FileInputStream(file);

mercurial