14
14
import java .nio .file .Files ;
15
15
import java .nio .file .Path ;
16
16
17
- @ BaseCmd .Syntax (cmd = "d2j-generate-stub-from-odex" , syntax = "[options] <odex0> [odex1 ... odexN]" , desc = "Genenerate no-code jar from odex" )
17
+ @ BaseCmd .Syntax (cmd = "d2j-generate-stub-from-odex" , syntax = "[options] <odex0> [odex1 ... odexN]" , desc =
18
+ "Generate no-code jar from odex" )
18
19
public class GenerateCompileStubFromOdex extends BaseCmd {
19
20
private static final int MAGIC_ODEX = 0x0A796564 & 0x00FFFFFF ;// hex for 'dey ', ignore the 0A
20
21
private static final int MAGIC_DEX = 0x0A786564 & 0x00FFFFFF ;// hex for 'dex ', ignore the 0A
@@ -31,7 +32,7 @@ public static void main(String... args) {
31
32
@ Override
32
33
protected void doCommandLine () throws Exception {
33
34
if (remainingArgs .length == 0 ) {
34
- throw new HelpException ("no odex" );
35
+ throw new HelpException ("No odex" );
35
36
}
36
37
if (output == null ) {
37
38
output = new File ("stub.jar" ).toPath ();
@@ -40,7 +41,7 @@ protected void doCommandLine() throws Exception {
40
41
try (FileSystem fs = createZip (output )) {
41
42
Path out = fs .getPath ("/" );
42
43
for (String x : remainingArgs ) {
43
- System .err .println ("process " + x + " ..." );
44
+ System .err .println ("Processing " + x + " ..." );
44
45
ByteBuffer bs = ByteBuffer .wrap (Files .readAllBytes (new File (x ).toPath ()))
45
46
.order (ByteOrder .LITTLE_ENDIAN );
46
47
int magic = bs .getInt (0 ) & 0x00FFFFFF ;
@@ -53,7 +54,7 @@ protected void doCommandLine() throws Exception {
53
54
} else if (magic == MAGIC_DEX ) {
54
55
doDex (bs , out );
55
56
} else {
56
- throw new RuntimeException ("file " + x + " is not an dex or odex" );
57
+ throw new RuntimeException ("File " + x + " is not an dex or odex" );
57
58
}
58
59
59
60
}
@@ -70,7 +71,7 @@ private void doDex(ByteBuffer bs, final Path out) {
70
71
public ClassVisitor create (final String classInternalName ) {
71
72
final Path target = out .resolve (classInternalName + ".class" );
72
73
if (Files .exists (target )) {
73
- System .err .println ("class " + classInternalName + " is already exists, skipping." );
74
+ System .err .println ("Class " + classInternalName + " already exists, skipping." );
74
75
return null ;
75
76
}
76
77
return new ClassVisitor (Opcodes .ASM4 , new ClassWriter (ClassWriter .COMPUTE_MAXS )) {
0 commit comments