本文整理汇总了Java中com.strobel.decompiler.PlainTextOutput类的典型用法代码示例。如果您正苦于以下问题:Java PlainTextOutput类的具体用法?Java PlainTextOutput怎么用?Java PlainTextOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlainTextOutput类属于com.strobel.decompiler包,在下文中一共展示了PlainTextOutput类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: decompile
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
@Override
public String decompile(InputStream inputStream, String entryName) throws IOException {
logger.debug("Decompiling... {}", entryName);
File tempFile = createTempFile(entryName, inputStream);
tempFile.deleteOnExit();
String decompiledFileName = getDecompiledFileName(entryName);
File decompiledFile = new File(decompiledFileName);
decompiledFile.getParentFile().mkdirs();
StringWriter pw = new StringWriter();
try {
com.strobel.decompiler.Decompiler.decompile(tempFile.getAbsolutePath(), new PlainTextOutput(pw));
} catch (Exception e) {
logger.info("Error while decompiling {}. " , entryName);
throw e;
}
pw.flush();
String decompiledFileContent = pw.toString();
FileUtils.writeStringToFile(decompiledFile, decompiledFileContent);
return decompiledFileContent;
}
开发者ID:fergarrui,项目名称:custom-bytecode-analyzer,代码行数:24,代码来源:ZipEntryDecompiler.java
示例2: startWarmUpThread
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
public void startWarmUpThread() {
new Thread() {
public void run() {
try {
Thread.sleep(500);
String internalName = FindBox.class.getName();
TypeReference type = metadataSystem.lookupType(internalName);
TypeDefinition resolvedType = null;
if ((type == null) || ((resolvedType = type.resolve()) == null)) {
return;
}
StringWriter stringwriter = new StringWriter();
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput
.setUnicodeOutputEnabled(decompilationOptions.getSettings().isUnicodeOutputEnabled());
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
String decompiledSource = stringwriter.toString();
OpenFile open = new OpenFile(internalName, "*/" + internalName, theme, mainWindow);
open.setContent(decompiledSource);
JTabbedPane pane = new JTabbedPane();
pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
pane.addTab("title", open.scrollPane);
pane.setSelectedIndex(pane.indexOfTab("title"));
} catch (Exception e) {
Luyten.showExceptionDialog("Exception!", e);
}
}
}.start();
}
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:30,代码来源:Model.java
示例3: decompileWithoutLinks
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
private void decompileWithoutLinks() {
this.invalidateContent();
isNavigationLinksValid = false;
textArea.setHyperlinksEnabled(false);
StringWriter stringwriter = new StringWriter();
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput.setUnicodeOutputEnabled(decompilationOptions.getSettings().isUnicodeOutputEnabled());
settings.getLanguage().decompileType(type, plainTextOutput, decompilationOptions);
setContentPreserveLastScrollPosition(stringwriter.toString());
this.isContentValid = true;
}
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:13,代码来源:OpenFile.java
示例4: getSource
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
public String getSource(CompilationUnit sourceTree) {
// render the AST into source
StringWriter buf = new StringWriter();
sourceTree.acceptVisitor(new InsertParenthesesVisitor(), null);
sourceTree.acceptVisitor(new JavaOutputVisitor(new PlainTextOutput(buf), m_settings), null);
return buf.toString();
}
开发者ID:cccssw,项目名称:enigma-vk,代码行数:8,代码来源:Deobfuscator.java
示例5: startWarmUpThread
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
public void startWarmUpThread() {
new Thread() {
public void run() {
try {
Thread.sleep(500);
String internalName = FindBox.class.getName();
TypeReference type = metadataSystem.lookupType(internalName);
TypeDefinition resolvedType = null;
if ((type == null) || ((resolvedType = type.resolve()) == null)) {
return;
}
StringWriter stringwriter = new StringWriter();
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput
.setUnicodeOutputEnabled(decompilationOptions.getSettings().isUnicodeOutputEnabled());
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
String decompiledSource = stringwriter.toString();
OpenFile open = new OpenFile(internalName, "*/" + internalName, theme, mainWindow);
open.setContent(decompiledSource);
JTabbedPane pane = new JTabbedPane();
pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
pane.addTab("title", open.scrollPane);
pane.setSelectedIndex(pane.indexOfTab("title"));
} catch (Exception e) {
Luyten.showExceptionDialog("Exception!", e);
}
}
}.start();
}
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:30,代码来源:Model.java
示例6: decompileWithoutLinks
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
private void decompileWithoutLinks() {
this.invalidateContent();
isNavigationLinksValid = false;
textArea.setHyperlinksEnabled(false);
StringWriter stringwriter = new StringWriter();
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput.setUnicodeOutputEnabled(decompilationOptions.getSettings().isUnicodeOutputEnabled());
settings.getLanguage().decompileType(type, plainTextOutput, decompilationOptions);
setContentPreserveLastScrollPosition(stringwriter.toString());
this.isContentValid = true;
}
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:13,代码来源:OpenFile.java
示例7: doSaveClassDecompiled
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
private void doSaveClassDecompiled(File inFile, File outFile) throws Exception {
DecompilerSettings settings = cloneSettings();
LuytenTypeLoader typeLoader = new LuytenTypeLoader();
MetadataSystem metadataSystem = new MetadataSystem(typeLoader);
TypeReference type = metadataSystem.lookupType(inFile.getCanonicalPath());
DecompilationOptions decompilationOptions = new DecompilationOptions();
decompilationOptions.setSettings(settings);
decompilationOptions.setFullDecompilation(true);
boolean isUnicodeEnabled = decompilationOptions.getSettings().isUnicodeOutputEnabled();
TypeDefinition resolvedType = null;
if (type == null || ((resolvedType = type.resolve()) == null)) {
throw new Exception("Unable to resolve type.");
}
StringWriter stringwriter = new StringWriter();
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput.setUnicodeOutputEnabled(isUnicodeEnabled);
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
String decompiledSource = stringwriter.toString();
System.out.println("[SaveAll]: " + inFile.getName() + " -> " + outFile.getName());
try (FileOutputStream fos = new FileOutputStream(outFile);
OutputStreamWriter writer = isUnicodeEnabled ? new OutputStreamWriter(fos, "UTF-8")
: new OutputStreamWriter(fos);
BufferedWriter bw = new BufferedWriter(writer);) {
bw.write(decompiledSource);
bw.flush();
}
}
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:31,代码来源:FileSaver.java
示例8: decompile
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
private void decompile(File classFile, File srcFolder) {
try {
File outputFile = convertClassFileToOutputFile(classFile, srcFolder);
outputFile.getParentFile().mkdirs();
PlainTextOutput output = new PlainTextOutput(new OutputStreamWriter(new FileOutputStream(outputFile.getAbsolutePath())));
DecompilerSettings settings = DecompilerSettings.javaDefaults();
settings.setForceExplicitImports(true);
settings.setOutputFileHeaderText("Generated with Procyon v" + Procyon.version());
Decompiler.decompile(classFile.getAbsolutePath(), output, settings);
} catch (IOException ex) {
Logger.error("Unable to decompile " + classFile.getAbsolutePath(), ex);
}
}
开发者ID:dwatling,项目名称:apk-decompiler,代码行数:15,代码来源:DecompileClasses.java
示例9: getSource
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
public String getSource(CompilationUnit sourceTree) {
// render the AST into source
StringWriter buf = new StringWriter();
sourceTree.acceptVisitor(new InsertParenthesesVisitor(), null);
sourceTree.acceptVisitor(new JavaOutputVisitor(new PlainTextOutput(buf), this.settings), null);
return buf.toString();
}
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:8,代码来源:Deobfuscator.java
示例10: getSource
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
public String getSource(CompilationUnit sourceTree)
{
// render the AST into source
StringWriter buf = new StringWriter();
sourceTree.acceptVisitor(new InsertParenthesesVisitor(), null);
sourceTree.acceptVisitor(new JavaOutputVisitor(
new PlainTextOutput(buf), m_settings), null);
return buf.toString();
}
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:10,代码来源:Deobfuscator.java
示例11: actionPerformed
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
tmp_thread = new Thread() {
public void run() {
if (findButton.getText().equals("Stop")) {
if (tmp_thread != null)
tmp_thread.interrupt();
setStatus("Stopped.");
findButton.setText("Find");
} else {
findButton.setText("Stop");
classesList.clear();
ConfigSaver configSaver = ConfigSaver.getLoadedInstance();
DecompilerSettings settings = configSaver.getDecompilerSettings();
File inFile = MainWindow.model.getOpenedFile();
boolean filter = ConfigSaver.getLoadedInstance().getLuytenPreferences()
.isFilterOutInnerClassEntries();
try {
JarFile jfile = new JarFile(inFile);
Enumeration<JarEntry> entLength = jfile.entries();
initProgressBar(Collections.list(entLength).size());
Enumeration<JarEntry> ent = jfile.entries();
while (ent.hasMoreElements() && findButton.getText().equals("Stop")) {
JarEntry entry = ent.nextElement();
String name = entry.getName();
setStatus(name);
if (filter && name.contains("$"))
continue;
if (entry.getName().endsWith(".class")) {
synchronized (settings) {
String internalName = StringUtilities.removeRight(entry.getName(), ".class");
TypeReference type = Model.metadataSystem.lookupType(internalName);
TypeDefinition resolvedType = null;
if (type == null || ((resolvedType = type.resolve()) == null)) {
throw new Exception("Unable to resolve type.");
}
StringWriter stringwriter = new StringWriter();
DecompilationOptions decompilationOptions;
decompilationOptions = new DecompilationOptions();
decompilationOptions.setSettings(settings);
decompilationOptions.setFullDecompilation(true);
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput.setUnicodeOutputEnabled(
decompilationOptions.getSettings().isUnicodeOutputEnabled());
settings.getLanguage().decompileType(resolvedType, plainTextOutput,
decompilationOptions);
String decompiledSource = stringwriter.toString().toLowerCase();
if (decompiledSource.contains(textField.getText().toLowerCase())) {
addClassName(entry.getName());
}
}
}
}
setSearching(false);
if (findButton.getText().equals("Stop")) {
setStatus("Done.");
findButton.setText("Find");
}
jfile.close();
} catch (Exception e) {
Luyten.showExceptionDialog("Exception!", e);
}
}
}
};
tmp_thread.start();
}
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:70,代码来源:FindAllBox.java
示例12: decompileClassNode
import com.strobel.decompiler.PlainTextOutput; //导入依赖的package包/类
@Override
public String decompileClassNode(final ClassNode cn, byte[] b) {
try {
if (cn.version < 49) {
b = fixBytes(b);
}
final byte[] bytesToUse = b;
final Map<String, byte[]> loadedClasses = BytecodeViewer.getLoadedBytes();
DecompilerSettings settings = getDecompilerSettings();
MetadataSystem metadataSystem = new MetadataSystem(new ITypeLoader() {
private InputTypeLoader backLoader = new InputTypeLoader();
@Override
public boolean tryLoadType(String s, Buffer buffer) {
if (s.equals(cn.name)) {
buffer.putByteArray(bytesToUse, 0, bytesToUse.length);
buffer.position(0);
return true;
} else {
byte[] toUse = loadedClasses.get(s + ".class");
if (toUse != null) {
buffer.putByteArray(toUse, 0, toUse.length);
buffer.position(0);
return true;
} else {
return backLoader.tryLoadType(s, buffer);
}
}
}
});
TypeReference type = metadataSystem.lookupType(cn.name);
DecompilationOptions decompilationOptions = new DecompilationOptions();
decompilationOptions.setSettings(DecompilerSettings.javaDefaults());
decompilationOptions.setFullDecompilation(true);
TypeDefinition resolvedType = null;
if (type == null || ((resolvedType = type.resolve()) == null)) {
throw new Exception("Unable to resolve type.");
}
StringWriter stringwriter = new StringWriter();
settings.getLanguage().decompileType(resolvedType, new PlainTextOutput(stringwriter), decompilationOptions);
String decompiledSource = stringwriter.toString();
return decompiledSource;
} catch (Throwable e) {
return parseException(e);
}
}
开发者ID:Konloch,项目名称:bytecode-viewer,代码行数:47,代码来源:ProcyonDecompiler.java
注:本文中的com.strobel.decompiler.PlainTextOutput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论