PrintStream replaced with PrintWriter

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@920 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 5764dddd92
commit b7154b62d7
  1. 2
      jode/jode/Decompiler.java
  2. 4
      jode/jode/GlobalOptions.java
  3. 27
      jode/jode/JodeWindow.java
  4. 4
      jode/jode/obfuscator/Main.java
  5. 28
      jode/jode/swingui/Main.java

@ -55,7 +55,7 @@ public class Decompiler {
public static int outputStyle = SUN_STYLE;
public static void usage() {
PrintStream err = GlobalOptions.err;
PrintWriter err = GlobalOptions.err;
err.println("Version: " + GlobalOptions.version);
err.print("use: jode [-v]"
+"[--cp <classpath>][--dest <destdir>]"

@ -18,7 +18,7 @@
*/
package jode;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class GlobalOptions {
@ -29,7 +29,7 @@ public class GlobalOptions {
public final static String URL =
"http://www.informatik.uni-oldenburg.de/~delwi/jode/jode.html";
public static PrintStream err = System.err;
public static PrintWriter err = new PrintWriter(System.err);
public static int verboseLevel = 0;
public static int debuggingFlags = 0;

@ -143,7 +143,7 @@ public class JodeWindow
startButton.addActionListener(this);
saveButton.addActionListener(this);
///#endif
GlobalOptions.err = new PrintStream(new AreaOutputStream(errorArea));
GlobalOptions.err = new PrintWriter(new AreaWriter(errorArea));
}
public void setClasspath(String cp) {
@ -200,36 +200,30 @@ public class JodeWindow
}
}
public class AreaOutputStream extends OutputStream {
public class AreaWriter extends Writer {
boolean initialized = false;
private TextArea area;
public AreaOutputStream(TextArea a) {
public AreaWriter(TextArea a) {
area = a;
}
public void write(int b) throws IOException {
public void write(char[] b, int off, int len) throws IOException {
if (!initialized) {
area.setText("");
initialized = true;
}
///#ifdef AWT10
/// area.appendText(String.valueOf((char)b));
/// area.appendText(new String(b, off, len));
///#else
area.append(String.valueOf((char)b));
area.append(new String(b, off, len));
///#endif
}
public void write(byte[] b, int off, int len) throws IOException {
if (!initialized) {
area.setText("");
initialized = true;
public void flush() {
}
///#ifdef AWT10
/// area.appendText(new String(b, off, len));
///#else
area.append(new String(b, off, len));
///#endif
public void close() {
}
}
@ -266,8 +260,7 @@ public class JodeWindow
}
TabbedPrintWriter writer =
new TabbedPrintWriter(new AreaOutputStream(sourcecodeArea)
, imports);
new TabbedPrintWriter(new AreaWriter(sourcecodeArea), imports);
ClassAnalyzer clazzAna = new ClassAnalyzer(null, clazz, imports);
clazzAna.dumpJavaFile(writer);

@ -22,7 +22,7 @@ import jode.bytecode.ClassInfo;
import jode.obfuscator.*;
import java.util.Vector;
import java.lang.reflect.Modifier;
import java.io.PrintStream;
import java.io.PrintWriter;
public class Obfuscator {
public static boolean shouldStrip = true;
@ -42,7 +42,7 @@ public class Obfuscator {
public static final int RENAME_NONE = 3;
public static void usage() {
PrintStream err = GlobalOptions.err;
PrintWriter err = GlobalOptions.err;
err.println("usage: jode.Obfuscator flags* [class | package]*");
err.println("\t-v "+
"Verbose output (allowed multiple times).");

@ -87,7 +87,7 @@ public class MainWindow
rightPane.setDividerSize(4);
allPane.setDividerLocation(200);
allPane.setDividerSize(4);
GlobalOptions.err = new PrintStream(new AreaOutputStream(errorArea));
GlobalOptions.err = new PrintWriter(new AreaWriter(errorArea));
}
public synchronized void valueChanged(TreeSelectionEvent e) {
@ -138,19 +138,30 @@ public class MainWindow
}
}
public class AreaOutputStream extends OutputStream {
public class AreaWriter extends Writer {
boolean initialized = false;
private JTextArea area;
public AreaOutputStream(JTextArea a) {
public AreaWriter(JTextArea a) {
area = a;
}
public void write(int b) throws IOException {
area.append(String.valueOf((byte)b));
public void write(char[] b, int off, int len) throws IOException {
if (!initialized) {
area.setText("");
initialized = true;
}
public void write(byte[] b, int off, int len) throws IOException {
///#ifdef AWT10
/// area.appendText(new String(b, off, len));
///#else
area.append(new String(b, off, len));
///#endif
}
public void flush() {
}
public void close() {
}
}
@ -173,8 +184,7 @@ public class MainWindow
sourcecodeArea.setText("");
TabbedPrintWriter writer =
new TabbedPrintWriter(new AreaOutputStream(sourcecodeArea)
, imports);
new TabbedPrintWriter(new AreaWriter(sourcecodeArea), imports);
imports.dumpHeader(writer);
clazzAna.dumpSource(writer);

Loading…
Cancel
Save