From fad685bf51cbf935a4d6363f51ebfd82b8e86023 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 14 Apr 1999 19:54:43 +0000 Subject: [PATCH] ImportHandler added git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@594 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/decompiler/TabbedPrintWriter.java | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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