Quantcast
Channel: MobileRead Forums - Kindle Developer's Corner
Viewing all articles
Browse latest Browse all 4396

Tools Java Bytecode Editor + Method Tools

$
0
0
Ando Saabas' JBE is very popular here because it allows user to modify features like margins width, tweak font size selection list, enable few hidden menu items (PDF reflow, Wi-Fi on/off,...), etc.

I have added two new classes to JBE: ExportMethod and ImportMethod.
The purpose of these tools is to avoid unnecessary clicking when performing bytecode changes.
Besides that I've also fixed two JBE bugs that prevented JBE from being able to eat its own dog food.

Usage:
java eu.smidovi.david.methodtools.ExportMethod <class file> [<method>] [<method signature>]
If <method> is not specified, <init> (the constructor) is used.
If <method signature> is not specified, the first method with the name <method> is used.
Method bytecode is printed on the standard output, e.g.:
Code:

java eu.smidovi.david.methodtools.ExportMethod ReaderResources_en_GB.class > ReaderResources_en_GB.bytecode
This will dump the class constructor to the given file.

Usage of ImportMethod is very similar:
java eu.smidovi.david.methodtools.ImportMethod <class file> [<method>] [<method signature>]
This reads bytecode from the standard input and replaces given method's code in the class file with the bytecode.
E.g.:
Code:

java eu.smidovi.david.methodtools.ImportMethod ReaderResources_en_GB.class < ReaderResources_en_GB.bytecode
On Linux, you can use included helper scripts em and im (I recommend creating symlinks in your path):
Code:

em ReaderResources_en_GB.class > ReaderResources_en_GB.bytecode
Bugs fixed:
  • JBE was not able to parse byte constants greater than 127, but happily produced them on output.
  • JBE was not able to parse multiline string constants it produced. I've fixed that by C-style escaping of special characters, <LF> included.

Attached Files
File Type: zip jbe_mt.zip (2.12 MB)

Viewing all articles
Browse latest Browse all 4396

Trending Articles