本文整理汇总了Java中org.jf.util.StringUtils类的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringUtils类属于org.jf.util包,在下文中一共展示了StringUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeAnnotator
import org.jf.util.StringUtils; //导入依赖的package包/类
@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);
}
};
}
示例2: makeAnnotator
import org.jf.util.StringUtils; //导入依赖的package包/类
@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));
}
};
}
示例3: getReferenceString
import org.jf.util.StringUtils; //导入依赖的package包/类
@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;
}
示例4: makeAnnotator
import org.jf.util.StringUtils; //导入依赖的package包/类
public static SectionAnnotator makeAnnotator( DexAnnotator annotator, MapItem mapItem) {
return new SectionAnnotator(annotator, mapItem) {
@Override public String getItemName() {
return "string_id_item";
}
@Override
public void annotateItem( AnnotatedBytes out, int itemIndex, 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);
}
};
}
示例5: makeAnnotator
import org.jf.util.StringUtils; //导入依赖的package包/类
public static SectionAnnotator makeAnnotator( DexAnnotator annotator, MapItem mapItem) {
return new SectionAnnotator(annotator, mapItem) {
@Override public String getItemName() {
return "string_data_item";
}
@Override
protected void annotateItem( AnnotatedBytes out, int itemIndex, 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));
}
};
}
示例6: makeAnnotator
import org.jf.util.StringUtils; //导入依赖的package包/类
@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));
}
};
}
示例7: getReferenceString
import org.jf.util.StringUtils; //导入依赖的package包/类
@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;
}
示例8: writeTo
import org.jf.util.StringUtils; //导入依赖的package包/类
@Override
public boolean writeTo(IndentingWriter writer) throws IOException {
writer.write(".source");
if (sourceFile != null) {
writer.write(" \"");
StringUtils.writeEscapedString(writer, sourceFile);
writer.write('"');
}
return true;
}
示例9: writeSourceFile
import org.jf.util.StringUtils; //导入依赖的package包/类
private void writeSourceFile(IndentingWriter writer) throws IOException {
String sourceFile = classDef.getSourceFile();
if (sourceFile != null) {
writer.write(".source \"");
StringUtils.writeEscapedString(writer, sourceFile);
writer.write("\"\n");
}
}
示例10: getReferenceAnnotation
import org.jf.util.StringUtils; //导入依赖的package包/类
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);
}
示例11: getReferenceAnnotation
import org.jf.util.StringUtils; //导入依赖的package包/类
public static String getReferenceAnnotation( 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);
}
示例12: makeAnnotator
import org.jf.util.StringUtils; //导入依赖的package包/类
@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);
}
};
}