Skip to content

Commit 196aa88

Browse files
committed
#11 DEX format - rename items
1 parent 7ac8c87 commit 196aa88

File tree

16 files changed

+445
-372
lines changed

16 files changed

+445
-372
lines changed

CommonLib/src/main/java/org/freeinternals/commonlib/ui/JTreeNodeFileComponent.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ public String getText() {
148148
public Icon getIcon() {
149149
return this.icon;
150150
}
151+
152+
/**
153+
* Setter for {@link #icon}.
154+
*
155+
* @param icon value for {@link #icon}
156+
*/
157+
public void setIcon(Icon icon) {
158+
this.icon = icon;
159+
}
151160

152161
/**
153162
* Setter for {@link #description}.
@@ -176,7 +185,7 @@ public String getDescription() {
176185
public void setDetailPanel(final JPanel p) {
177186
this.panelDetail = p;
178187
}
179-
188+
180189
/**
181190
* Indicates whether we have a detailed panel {@link #panelDetail}.
182191
*

FormatDEX/src/main/java/org/freeinternals/format/dex/DexFile.java

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
import java.util.SortedMap;
1616
import java.util.TreeMap;
1717
import javax.swing.tree.DefaultMutableTreeNode;
18-
import org.freeinternals.biv.ui.dex.TreeNodeGenerator;
1918
import org.freeinternals.commonlib.core.FileComponent;
2019
import org.freeinternals.commonlib.core.FileFormat;
2120
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
2221
import org.freeinternals.commonlib.core.PosDataInputStream;
2322
import org.freeinternals.commonlib.core.BytesTool;
2423
import org.freeinternals.commonlib.core.FileFormatException;
25-
import org.freeinternals.format.dex.HeaderItem.Endian;
24+
import org.freeinternals.format.dex.header_item.Endian;
2625

2726
/**
2827
*
@@ -67,17 +66,16 @@ public class DexFile extends FileFormat {
6766
/**
6867
* The file header.
6968
*/
70-
public HeaderItem header;
69+
public header_item header;
7170
/**
72-
* String identifiers list, or <code>null</code> if
73-
* {@link HeaderItem#string_ids_off} is <code>0</code>.
71+
* String identifiers list, or <code>null{@link header_item#string_ids_off} is <code>0
7472
*/
75-
public StringIdItem[] string_ids;
76-
public TypeIdItem[] type_ids;
77-
public ProtoIdItem[] proto_ids;
78-
public FieldIdItem[] field_ids;
79-
public MethodIdItem[] method_ids;
80-
public ClassDefItem[] class_defs;
73+
public string_id_item[] string_ids;
74+
public type_id_item[] type_ids;
75+
public proto_id_item[] proto_ids;
76+
public field_id_item[] field_ids;
77+
public method_id_item[] method_ids;
78+
public class_def_item[] class_defs;
8179
// public Dex_ubyte[] data;
8280
/**
8381
* The parsed file components.
@@ -172,16 +170,16 @@ private void parse() throws IOException, FileFormatException {
172170
// Header
173171
BytesTool.skip(stream, DEX_FILE_MAGIC1.size());
174172
BytesTool.skip(stream, DEX_FILE_MAGIC2.size());
175-
this.header = new HeaderItem(stream);
173+
this.header = new header_item(stream);
176174

177175
// string_ids
178176
if (this.header.string_ids_off.intValue() == 0) {
179177
this.string_ids = null;
180178
} else {
181179
stream.flyTo(this.header.string_ids_off.intValue());
182-
this.string_ids = new StringIdItem[this.header.string_ids_size.intValue()];
180+
this.string_ids = new string_id_item[this.header.string_ids_size.intValue()];
183181
for (int i = 0; i < this.string_ids.length; i++) {
184-
this.string_ids[i] = new StringIdItem(stream);
182+
this.string_ids[i] = new string_id_item(stream);
185183
todoData.put(this.string_ids[i].string_data_off.value, StringDataItem.class);
186184
}
187185
}
@@ -191,9 +189,9 @@ private void parse() throws IOException, FileFormatException {
191189
this.type_ids = null;
192190
} else {
193191
stream.flyTo(this.header.type_ids_off.intValue());
194-
this.type_ids = new TypeIdItem[this.header.type_ids_size.intValue()];
192+
this.type_ids = new type_id_item[this.header.type_ids_size.intValue()];
195193
for (int i = 0; i < this.type_ids.length; i++) {
196-
this.type_ids[i] = new TypeIdItem(stream);
194+
this.type_ids[i] = new type_id_item(stream);
197195
}
198196
}
199197

@@ -202,9 +200,9 @@ private void parse() throws IOException, FileFormatException {
202200
this.proto_ids = null;
203201
} else {
204202
stream.flyTo(this.header.proto_ids_off.intValue());
205-
this.proto_ids = new ProtoIdItem[this.header.proto_ids_size.intValue()];
203+
this.proto_ids = new proto_id_item[this.header.proto_ids_size.intValue()];
206204
for (int i = 0; i < this.proto_ids.length; i++) {
207-
this.proto_ids[i] = new ProtoIdItem(stream);
205+
this.proto_ids[i] = new proto_id_item(stream);
208206
}
209207
}
210208

@@ -213,9 +211,9 @@ private void parse() throws IOException, FileFormatException {
213211
this.field_ids = null;
214212
} else {
215213
stream.flyTo(this.header.field_ids_off.intValue());
216-
this.field_ids = new FieldIdItem[this.header.field_ids_size.intValue()];
214+
this.field_ids = new field_id_item[this.header.field_ids_size.intValue()];
217215
for (int i = 0; i < this.field_ids.length; i++) {
218-
this.field_ids[i] = new FieldIdItem(stream);
216+
this.field_ids[i] = new field_id_item(stream);
219217
}
220218
}
221219

@@ -224,9 +222,9 @@ private void parse() throws IOException, FileFormatException {
224222
this.method_ids = null;
225223
} else {
226224
stream.flyTo(this.header.method_ids_off.intValue());
227-
this.method_ids = new MethodIdItem[this.header.method_ids_size.intValue()];
225+
this.method_ids = new method_id_item[this.header.method_ids_size.intValue()];
228226
for (int i = 0; i < this.method_ids.length; i++) {
229-
this.method_ids[i] = new MethodIdItem(stream);
227+
this.method_ids[i] = new method_id_item(stream);
230228
}
231229
}
232230

@@ -235,9 +233,9 @@ private void parse() throws IOException, FileFormatException {
235233
this.class_defs = null;
236234
} else {
237235
stream.flyTo(this.header.class_defs_off.intValue());
238-
this.class_defs = new ClassDefItem[this.header.class_defs_size.intValue()];
236+
this.class_defs = new class_def_item[this.header.class_defs_size.intValue()];
239237
for (int i = 0; i < this.class_defs.length; i++) {
240-
this.class_defs[i] = new ClassDefItem(stream);
238+
this.class_defs[i] = new class_def_item(stream);
241239
}
242240
}
243241

FormatDEX/src/main/java/org/freeinternals/format/dex/HeaderItem.java

Lines changed: 0 additions & 166 deletions
This file was deleted.

FormatDEX/src/main/java/org/freeinternals/format/dex/PosDataInputStreamDex.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
1111
import org.freeinternals.commonlib.core.PosDataInputStream;
1212
import org.freeinternals.commonlib.core.FileFormatException;
13-
import org.freeinternals.format.dex.HeaderItem.Endian;
13+
import org.freeinternals.format.dex.header_item.Endian;
1414

1515
/**
1616
*
@@ -28,14 +28,14 @@ public class PosDataInputStreamDex extends PosDataInputStream {
2828
* {@link HeaderItem.Endian#ENDIAN_CONSTANT}, as the DEX format
2929
* specification said.
3030
*/
31-
protected final HeaderItem.Endian endian;
31+
protected final header_item.Endian endian;
3232

3333
public PosDataInputStreamDex(PosByteArrayInputStream in) {
3434
super(in);
3535
this.endian = Endian.ENDIAN_CONSTANT;
3636
}
3737

38-
public PosDataInputStreamDex(PosByteArrayInputStream in, HeaderItem.Endian e) {
38+
public PosDataInputStreamDex(PosByteArrayInputStream in, header_item.Endian e) {
3939
super(in);
4040
this.endian = e;
4141
}
@@ -67,7 +67,7 @@ public Type_ubyte Dex_ubyte() throws IOException {
6767
* @throws java.io.IOException I/O Error
6868
*/
6969
public Type_short Dex_short() throws IOException {
70-
if (this.endian == HeaderItem.Endian.ENDIAN_CONSTANT) {
70+
if (this.endian == header_item.Endian.ENDIAN_CONSTANT) {
7171
return new Type_short(this.readShort());
7272
} else {
7373
return new Type_short(this.readShortInLittleEndian());
@@ -81,7 +81,7 @@ public Type_short Dex_short() throws IOException {
8181
* @throws java.io.IOException I/O Error
8282
*/
8383
public Type_ushort Dex_ushort() throws IOException {
84-
if (this.endian == HeaderItem.Endian.ENDIAN_CONSTANT) {
84+
if (this.endian == header_item.Endian.ENDIAN_CONSTANT) {
8585
return new Type_ushort(this.readUnsignedShort());
8686
} else {
8787
return new Type_ushort(this.readUnsignedShortInLittleEndian());
@@ -95,7 +95,7 @@ public Type_ushort Dex_ushort() throws IOException {
9595
* @throws java.io.IOException I/O Error
9696
*/
9797
public Type_int Dex_int() throws IOException {
98-
if (this.endian == HeaderItem.Endian.ENDIAN_CONSTANT) {
98+
if (this.endian == header_item.Endian.ENDIAN_CONSTANT) {
9999
return new Type_int(this.readInt());
100100
} else {
101101
return new Type_int(this.readIntInLittleEndian());
@@ -109,7 +109,7 @@ public Type_int Dex_int() throws IOException {
109109
* @throws java.io.IOException I/O Error
110110
*/
111111
public Type_uint Dex_uint() throws IOException {
112-
if (this.endian.value == HeaderItem.Endian.ENDIAN_CONSTANT.value) {
112+
if (this.endian.value == header_item.Endian.ENDIAN_CONSTANT.value) {
113113
return new Type_uint(this.readUnsignedInt());
114114
} else {
115115
return new Type_uint(this.readUnsignedIntInLittleEndian());
@@ -123,7 +123,7 @@ public Type_uint Dex_uint() throws IOException {
123123
* @throws java.io.IOException I/O Error
124124
*/
125125
public Type_long Dex_long() throws IOException {
126-
if (this.endian == HeaderItem.Endian.ENDIAN_CONSTANT) {
126+
if (this.endian == header_item.Endian.ENDIAN_CONSTANT) {
127127
return new Type_long(this.readLong());
128128
} else {
129129
return new Type_long(this.readLongInLittleEndian());
@@ -137,7 +137,7 @@ public Type_long Dex_long() throws IOException {
137137
* @throws java.io.IOException I/O Error
138138
*/
139139
public Type_ulong Dex_ulong() throws IOException {
140-
if (this.endian == HeaderItem.Endian.ENDIAN_CONSTANT) {
140+
if (this.endian == header_item.Endian.ENDIAN_CONSTANT) {
141141
return new Type_ulong(this.readUnsignedLong());
142142
} else {
143143
return new Type_ulong(this.readUnsignedLongInLittleEndian());

0 commit comments

Comments
 (0)