diff --git a/jode/jode/decompiler/TabbedPrintWriter.java b/jode/jode/decompiler/TabbedPrintWriter.java index e66e12e..fef7056 100644 --- a/jode/jode/decompiler/TabbedPrintWriter.java +++ b/jode/jode/decompiler/TabbedPrintWriter.java @@ -20,6 +20,7 @@ package jode.decompiler; import java.io.*; import jode.Decompiler; +import jode.type.Type; public class TabbedPrintWriter { boolean atbol; @@ -27,19 +28,30 @@ public class TabbedPrintWriter { int currentIndent = 0; String indentStr = ""; PrintWriter pw; + ImportHandler imports; - public TabbedPrintWriter (OutputStream os) { + public TabbedPrintWriter (OutputStream os, ImportHandler imports) { pw = new PrintWriter(os, true); + this.imports = imports; this.indentsize = (Decompiler.outputStyle & Decompiler.TAB_SIZE_MASK); atbol = true; } - public TabbedPrintWriter (Writer os) { + public TabbedPrintWriter (Writer os, ImportHandler imports) { pw = new PrintWriter(os, true); + this.imports = imports; this.indentsize = (Decompiler.outputStyle & Decompiler.TAB_SIZE_MASK); atbol = true; } + public TabbedPrintWriter (OutputStream os) { + this(os, null); + } + + public TabbedPrintWriter (Writer os) { + this(os, null); + } + /** * Convert the numeric indentation to a string. */ @@ -101,6 +113,13 @@ public class TabbedPrintWriter { atbol = false; } + public void printType(Type type) { + if (imports != null) + print(imports.getTypeString(type)); + else + print(type.toString()); + } + /** * Print a opening brace with the current indentation style. * Called at the end of the line of the instance that opens the