List of usage examples for org.eclipse.jdt.internal.compiler.util Util getFileByteContent
public static byte[] getFileByteContent(File file) throws IOException
From source file:org.ant4eclipse.lib.jdt.ecj.internal.tools.loader.FileClassFileImpl.java
License:Open Source License
public byte[] getBytes() { try {/* w w w .j a va2s . com*/ return Util.getFileByteContent(this._classfile); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:org.eclipse.che.jdt.core.ToolFactory.java
License:Open Source License
/** * Create a default classfile reader, able to expose the internal representation of a given classfile * according to the decoding flag used to initialize the reader. * Answer null if the file named fileName doesn't represent a valid .class file. * The fileName has to be an absolute OS path to the given .class file. * <p/>//from w w w. ja va 2s . co m * The decoding flags are described in IClassFileReader. * * @param fileName * the name of the file to be read * @param decodingFlag * the flag used to decode the class file reader. * @return a default classfile reader * @see org.eclipse.jdt.core.util.IClassFileReader */ public static IClassFileReader createDefaultClassFileReader(String fileName, int decodingFlag) { try { return new ClassFileReader(Util.getFileByteContent(new File(fileName)), decodingFlag); } catch (ClassFormatException e) { return null; } catch (IOException e) { return null; } }