org.jf.util.StringUtils Java Examples
The following examples show how to use
org.jf.util.StringUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StringIdItem.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_id_item"; } @Override public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int stringDataOffset = dexFile.readSmallUint(out.getCursor()); try { String stringValue = dexFile.getString(itemIndex); out.annotate(4, "string_data_item[0x%x]: \"%s\"", stringDataOffset, StringUtils.escapeString(stringValue)); return; } catch (Exception ex) { System.err.print("Error while resolving string value at index: "); System.err.print(itemIndex); ex.printStackTrace(System.err); } out.annotate(4, "string_id_item[0x%x]", stringDataOffset); } }; }
Example #2
Source File: StringDataItem.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_data_item"; } @Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { DexReader reader = dexFile.readerAt(out.getCursor()); int utf16Length = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length); String value = reader.readString(utf16Length); out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value)); } }; }
Example #3
Source File: ReferenceUtil.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nullable public static String getReferenceString(Reference reference) { if (reference instanceof StringReference) { return String.format("\"%s\"", StringUtils.escapeString(((StringReference)reference).getString())); } if (reference instanceof TypeReference) { return ((TypeReference)reference).getType(); } if (reference instanceof FieldReference) { return getFieldDescriptor((FieldReference)reference); } if (reference instanceof MethodReference) { return getMethodDescriptor((MethodReference)reference); } return null; }
Example #4
Source File: StringIdItem.java From HeyGirl with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_id_item"; } @Override public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int stringDataOffset = dexFile.readSmallUint(out.getCursor()); try { String stringValue = dexFile.getString(itemIndex); out.annotate(4, "string_data_item[0x%x]: \"%s\"", stringDataOffset, StringUtils.escapeString(stringValue)); return; } catch (Exception ex) { System.err.print("Error while resolving string value at index: "); System.err.print(itemIndex); ex.printStackTrace(System.err); } out.annotate(4, "string_id_item[0x%x]", stringDataOffset); } }; }
Example #5
Source File: ReferenceUtil.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nullable public static String getReferenceString(Reference reference) { if (reference instanceof StringReference) { return String.format("\"%s\"", StringUtils.escapeString(((StringReference)reference).getString())); } if (reference instanceof TypeReference) { return ((TypeReference)reference).getType(); } if (reference instanceof FieldReference) { return getFieldDescriptor((FieldReference)reference); } if (reference instanceof MethodReference) { return getMethodDescriptor((MethodReference)reference); } return null; }
Example #6
Source File: StringDataItem.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_data_item"; } @Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { DexReader reader = dexFile.readerAt(out.getCursor()); int utf16Length = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length); String value = reader.readString(utf16Length); out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value)); } }; }
Example #7
Source File: ReferenceUtil.java From zjdroid with Apache License 2.0 | 6 votes |
@Nullable public static String getReferenceString(Reference reference) { if (reference instanceof StringReference) { return String.format("\"%s\"", StringUtils.escapeString(((StringReference)reference).getString())); } if (reference instanceof TypeReference) { return ((TypeReference)reference).getType(); } if (reference instanceof FieldReference) { return getFieldDescriptor((FieldReference)reference); } if (reference instanceof MethodReference) { return getMethodDescriptor((MethodReference)reference); } return null; }
Example #8
Source File: StringIdItem.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_id_item"; } @Override public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int stringDataOffset = dexFile.readSmallUint(out.getCursor()); try { String stringValue = dexFile.getString(itemIndex); out.annotate(4, "string_data_item[0x%x]: \"%s\"", stringDataOffset, StringUtils.escapeString(stringValue)); return; } catch (Exception ex) { System.err.print("Error while resolving string value at index: "); System.err.print(itemIndex); ex.printStackTrace(System.err); } out.annotate(4, "string_id_item[0x%x]", stringDataOffset); } }; }
Example #9
Source File: StringDataItem.java From zjdroid with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_data_item"; } @Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { DexReader reader = dexFile.readerAt(out.getCursor()); int utf16Length = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length); String value = reader.readString(utf16Length); out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value)); } }; }
Example #10
Source File: ReferenceUtil.java From HeyGirl with Apache License 2.0 | 6 votes |
@Nullable public static String getReferenceString(Reference reference) { if (reference instanceof StringReference) { return String.format("\"%s\"", StringUtils.escapeString(((StringReference)reference).getString())); } if (reference instanceof TypeReference) { return ((TypeReference)reference).getType(); } if (reference instanceof FieldReference) { return getFieldDescriptor((FieldReference)reference); } if (reference instanceof MethodReference) { return getMethodDescriptor((MethodReference)reference); } return null; }
Example #11
Source File: StringIdItem.java From zjdroid with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_id_item"; } @Override public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int stringDataOffset = dexFile.readSmallUint(out.getCursor()); try { String stringValue = dexFile.getString(itemIndex); out.annotate(4, "string_data_item[0x%x]: \"%s\"", stringDataOffset, StringUtils.escapeString(stringValue)); return; } catch (Exception ex) { System.err.print("Error while resolving string value at index: "); System.err.print(itemIndex); ex.printStackTrace(System.err); } out.annotate(4, "string_id_item[0x%x]", stringDataOffset); } }; }
Example #12
Source File: StringDataItem.java From HeyGirl with Apache License 2.0 | 6 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "string_data_item"; } @Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { DexReader reader = dexFile.readerAt(out.getCursor()); int utf16Length = reader.readSmallUleb128(); out.annotateTo(reader.getOffset(), "utf16_size = %d", utf16Length); String value = reader.readString(utf16Length); out.annotateTo(reader.getOffset() + 1, "data = \"%s\"", StringUtils.escapeString(value)); } }; }
Example #13
Source File: ClassDefinition.java From zjdroid with Apache License 2.0 | 5 votes |
private void writeSourceFile(IndentingWriter writer) throws IOException { String sourceFile = classDef.getSourceFile(); if (sourceFile != null) { writer.write(".source \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write("\"\n"); } }
Example #14
Source File: StringIdItem.java From ZjDroid with Apache License 2.0 | 5 votes |
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) { try { String string = dexFile.getString(stringIndex); if (quote) { string = String.format("\"%s\"", StringUtils.escapeString(string)); } return String.format("string_id_item[%d]: %s", stringIndex, string); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("string_id_item[%d]", stringIndex); }
Example #15
Source File: StringIdItem.java From HeyGirl with Apache License 2.0 | 5 votes |
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) { try { String string = dexFile.getString(stringIndex); if (quote) { string = String.format("\"%s\"", StringUtils.escapeString(string)); } return String.format("string_id_item[%d]: %s", stringIndex, string); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("string_id_item[%d]", stringIndex); }
Example #16
Source File: SetSourceFileMethodItem.java From HeyGirl with Apache License 2.0 | 5 votes |
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write(".source"); if (sourceFile != null) { writer.write(" \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write('"'); } return true; }
Example #17
Source File: ClassDefinition.java From HeyGirl with Apache License 2.0 | 5 votes |
private void writeSourceFile(IndentingWriter writer) throws IOException { String sourceFile = classDef.getSourceFile(); if (sourceFile != null) { writer.write(".source \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write("\"\n"); } }
Example #18
Source File: StringIdItem.java From ZjDroid with Apache License 2.0 | 5 votes |
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) { try { String string = dexFile.getString(stringIndex); if (quote) { string = String.format("\"%s\"", StringUtils.escapeString(string)); } return String.format("string_id_item[%d]: %s", stringIndex, string); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("string_id_item[%d]", stringIndex); }
Example #19
Source File: SetSourceFileMethodItem.java From ZjDroid with Apache License 2.0 | 5 votes |
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write(".source"); if (sourceFile != null) { writer.write(" \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write('"'); } return true; }
Example #20
Source File: ClassDefinition.java From ZjDroid with Apache License 2.0 | 5 votes |
private void writeSourceFile(IndentingWriter writer) throws IOException { String sourceFile = classDef.getSourceFile(); if (sourceFile != null) { writer.write(".source \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write("\"\n"); } }
Example #21
Source File: SetSourceFileMethodItem.java From zjdroid with Apache License 2.0 | 5 votes |
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write(".source"); if (sourceFile != null) { writer.write(" \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write('"'); } return true; }
Example #22
Source File: SetSourceFileMethodItem.java From ZjDroid with Apache License 2.0 | 5 votes |
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write(".source"); if (sourceFile != null) { writer.write(" \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write('"'); } return true; }
Example #23
Source File: ClassDefinition.java From ZjDroid with Apache License 2.0 | 5 votes |
private void writeSourceFile(IndentingWriter writer) throws IOException { String sourceFile = classDef.getSourceFile(); if (sourceFile != null) { writer.write(".source \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write("\"\n"); } }
Example #24
Source File: SetSourceFileMethodItem.java From atlas with Apache License 2.0 | 5 votes |
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write(".source"); if (sourceFile != null) { writer.write(" \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write('"'); } return true; }
Example #25
Source File: ClassDefinition.java From atlas with Apache License 2.0 | 5 votes |
private void writeSourceFile(IndentingWriter writer) throws IOException { String sourceFile = classDef.getSourceFile(); if (sourceFile != null) { writer.write(".source \""); StringUtils.writeEscapedString(writer, sourceFile); writer.write("\"\n"); } }
Example #26
Source File: StringIdItem.java From zjdroid with Apache License 2.0 | 5 votes |
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) { try { String string = dexFile.getString(stringIndex); if (quote) { string = String.format("\"%s\"", StringUtils.escapeString(string)); } return String.format("string_id_item[%d]: %s", stringIndex, string); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("string_id_item[%d]", stringIndex); }
Example #27
Source File: HeaderItem.java From HeyGirl with Apache License 2.0 | 4 votes |
@Nonnull public static SectionAnnotator makeAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { return new SectionAnnotator(annotator, mapItem) { @Nonnull @Override public String getItemName() { return "header_item"; } @Override protected void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) { int startOffset = out.getCursor(); int headerSize; StringBuilder magicBuilder = new StringBuilder(); for (int i=0; i<8; i++) { magicBuilder.append((char)dexFile.readUbyte(startOffset + i)); } out.annotate(8, "magic: %s", StringUtils.escapeString(magicBuilder.toString())); out.annotate(4, "checksum"); out.annotate(20, "signature"); out.annotate(4, "file_size: %d", dexFile.readInt(out.getCursor())); headerSize = dexFile.readInt(out.getCursor()); out.annotate(4, "header_size: %d", headerSize); int endianTag = dexFile.readInt(out.getCursor()); out.annotate(4, "endian_tag: 0x%x (%s)", endianTag, getEndianText(endianTag)); out.annotate(4, "link_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "link_offset: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "map_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "string_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "string_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "type_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "type_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "proto_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "proto_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "field_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "field_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "method_ids_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "method_ids_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "class_defs_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "class_defs_off: 0x%x", dexFile.readInt(out.getCursor())); out.annotate(4, "data_size: %d", dexFile.readInt(out.getCursor())); out.annotate(4, "data_off: 0x%x", dexFile.readInt(out.getCursor())); if (headerSize > ITEM_SIZE) { out.annotateTo(headerSize, "header padding"); } } }; }
Example #28
Source File: CharRenderer.java From HeyGirl with Apache License 2.0 | 4 votes |
public static void writeTo(IndentingWriter writer, char val) throws IOException { writer.write('\''); StringUtils.writeEscapedChar(writer, val); writer.write('\''); }
Example #29
Source File: ReferenceFormatter.java From atlas with Apache License 2.0 | 4 votes |
public static void writeStringReference(IndentingWriter writer, String item) throws IOException { writer.write('"'); StringUtils.writeEscapedString(writer, item); writer.write('"'); }
Example #30
Source File: ReferenceFormatter.java From HeyGirl with Apache License 2.0 | 4 votes |
public static void writeStringReference(IndentingWriter writer, String item) throws IOException { writer.write('"'); StringUtils.writeEscapedString(writer, item); writer.write('"'); }