# HG changeset patch # User vromero # Date 1369759181 -3600 # Node ID c9d1984367b6ce0cb4c2d0a61d4f079b45b30e46 # Parent 846139633c68f73450aa4f6a34e0800263461c97 8012333: javac, ClassFile should have a read(Path) method Reviewed-by: jjg diff -r 846139633c68 -r c9d1984367b6 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);