(String fn, Configuration config)
| 127 | } |
| 128 | |
| 129 | private static LFunction file_to_function(String fn, Configuration config) throws IOException { |
| 130 | RandomAccessFile file = null; |
| 131 | try { |
| 132 | file = new RandomAccessFile(fn, "r"); |
| 133 | ByteBuffer buffer = ByteBuffer.allocate((int) file.length()); |
| 134 | buffer.order(ByteOrder.LITTLE_ENDIAN); |
| 135 | int len = (int) file.length(); |
| 136 | FileChannel in = file.getChannel(); |
| 137 | while(len > 0) len -= in.read(buffer); |
| 138 | buffer.rewind(); |
| 139 | BHeader header = new BHeader(buffer, config); |
| 140 | return header.main; |
| 141 | } finally { |
| 142 | if(file != null) { |
| 143 | file.close(); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | public static void decompile(String in, String out, Configuration config) throws IOException { |
| 149 | LFunction lmain = file_to_function(in, config); |
no test coverage detected