basereaderdebug.java

来自「First of all, the Applet-phone is a SIP 」· Java 代码 · 共 84 行

JAVA
84
字号
package gov.nist.examples.bps.reader;import java.io.*;/** Debugging println.**@version  JAIN-SIP-1.1**@author Olivier Deruelle <deruelle@nist.gov>  <br/>**<a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a>**/public class BaseReaderDebug {    public static  boolean debug;    private static String proxyOutput=null;    private static PrintStream stream=System.out;            public static void setProxyOutputFile(String proxyOut) {       System.out.println("We set the base reader output file to: "+proxyOut);       proxyOutput=proxyOut;    }        public static void writeFile(String inFile,String outFile, 	String text, boolean sep) {        // we read this file to obtain the options        try{            FileWriter fileWriter = new FileWriter(outFile,true);            PrintWriter pw = new PrintWriter(fileWriter,false);                        if (text==null) {                pw.println();            }            else            if (sep) {                 pw.print(text);            }            else {                 pw.println(text);            }                       pw.close();            fileWriter.close();        }        catch(Exception e) {            e.printStackTrace();        }    }        public static void logException(Exception ex) {	   if (debug) {	       ex.printStackTrace(stream);	    }	}        public static void println(String text){        if (debug) {            if (proxyOutput!=null)                writeFile(proxyOutput,proxyOutput,text,false);            else                 stream.println(text);        }    }        public static void println(){        if (debug) {            if (proxyOutput!=null)                writeFile(proxyOutput,proxyOutput,null,false);            else stream.println();        }    }        public static void print(String text){        if (debug) {            if (proxyOutput!=null)                writeFile(proxyOutput,proxyOutput,text,true);            else stream.print(text);        }    }    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?