public static void toDebug(Object debug, String mess){ String CRLF = ">\r\n"; String TAB = "\t"; String report = "<"+mess+">"+CRLF; if (debug instanceof Character){ Character bug = (Character)debug; report += TAB +""+CRLF; report += TAB + "<"+bug.toString()+ CRLF; } else if (debug instanceof Number){ report += TAB+""+CRLF; TAB+=TAB; Number bug = (Number)debug; report += TAB+"<"+bug.doubleValue()+CRLF; report += TAB+"<"+bug.floatValue()+CRLF; report += TAB+"<"+bug.intValue()+CRLF; report += TAB+"<"+bug.longValue()+CRLF; report += TAB+"<"+bug.shortValue()+CRLF; report += TAB+"<"+bug.toString()+CRLF; report += TAB+"<"+bug.byteValue()+CRLF; } else if (debug instanceof String){ report +=TAB+ ""+CRLF; String bug = (String)debug; report += TAB+TAB+"<"+bug.toString()+CRLF; } else if(debug instanceof HashMap){ report += TAB+" bugMap = (Map.Entry)bugIt.next(); report += TAB+TAB+"<"+bugMap.getKey()+"><"+bugMap.getValue()+CRLF; } } else if (debug instanceof Vector){ Vector parentBug = (Vector)debug; report += TAB+"<"+parentBug.size()+CRLF; for (Iterator bugIt = parentBug.iterator(); bugIt.hasNext();){ Object bug = (Object)bugIt.next(); if (bug instanceof HashMap){ HashMap bugMap = (HashMap)bug; report += TAB+TAB+"<"+bugMap.size()+CRLF; for (Iterator bugItt = bugMap.entrySet().iterator();bugIt.hasNext();){ Map.Entry bugMapEntry = (Map.Entry)bugItt.next(); report += TAB+TAB+TAB+"<"+bugMapEntry.getKey()+"><"+bugMapEntry.getValue()+CRLF; } } else { report += TAB+TAB+""+CRLF; report += TAB+TAB+TAB+"<"+bug.toString()+CRLF; report += TAB+TAB+TAB+"<"+bug.hashCode()+CRLF; } } }else if(debug instanceof DBImport) { report += TAB+"" + CRLF; DBImport bug = (DBImport)debug; report += TAB+TAB+"<" +bug.dbName + CRLF; report += TAB+TAB+"<"+bug.sql + CRLF; report += TAB+TAB+"<"+bug.toString()+CRLF; } else { report += TAB+debug.toString()+""+CRLF; } System.out.println(report+CRLF); toReport(Pearson2.DebugFile,report); } public static void CreateChargeTable (String fName){ String result = new String(); String lineIn = new String(); String TAB = "\t"; String CRLF = "\n\r"; File input = new File(fName); int len = 12; int inc = 8; if (input.exists()){ try { FileInputStream fstream = new FileInputStream(input); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); br.readLine(); while((lineIn = br.readLine())!=null){ int initPos = 750; for (int i =0; i<10; i++){ result += lineIn.substring(initPos, initPos + len)+ TAB; initPos += inc+len; } result += CRLF; } br.close(); }catch(Exception ee){ System.out.println(ee.getMessage()); } toReport("c:\\code\\EclipseWorkspace\\PearsonCharge.txt",result); } } public static void toReport(String fname, String arg){ try { BufferedWriter outp = new BufferedWriter(new FileWriter(fname,true)); outp.write(arg); outp.close(); } catch (IOException e) { System.out.println(e.getMessage()); } }