Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Juggle the input file into a byte array for later extraction
- File sourceFile = new File(STRIPPED_DIR, STRIPPED_SOURCE);
- long fileSize = sourceFile.length();
- System.out.format("File size: %dn", fileSize);
- byte[] fileBytes = new byte[(int) fileSize];
- FileInputStream fis = new FileInputStream(sourceFile);
- int bytesRead = fis.read(fileBytes);
- fis.close();
- System.out.format("Bytes read: %dn", bytesRead);
- // Parse input file.
- ANTLRInputStream input = new ANTLRInputStream(new ByteArrayInputStream(fileBytes));
- Dumper dumper = new Dumper(outWriter, usage, fileBytes);
- walker.walk(dumper, tree);
- private String originalString(int from, int till) {
- return new String(fileBytes, from, till-from+1);
- }
- private String originalString(ParserRuleContext ctx) {
- int from = ctx.start.getStartIndex();
- int till = ctx.stop.getStopIndex();
- return originalString(from, till);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement