NetLogpublic class NetLog extends Object NetLog - NetLog client API. |
Fields Summary |
---|
protected static final int | NETLOG_PORT | protected int | port | protected Socket | sock | protected PrintWriter | os |
Constructors Summary |
---|
public NetLog()
this(NETLOG_PORT);
| public NetLog(int prtNum)
this(InetAddress.getLocalHost(), prtNum);
| public NetLog(String host, int prtNum)
this(InetAddress.getByName(host), prtNum);
| public NetLog(InetAddress host, int prtNum)
port = prtNum;
sock = new Socket(host, prtNum);
os = new PrintWriter(
new OutputStreamWriter(
sock.getOutputStream(), "8859_1"), true);
|
Methods Summary |
---|
public void | close()Close the log.
os.close();
os = null;
| public void | log(java.lang.String mesg)Send one String to the log
if (os == null)
return;
// System.out.print(">> ");
os.print(mesg);
// Do the CRLF ourself since println appends only a \r on
// platforms where that is the native line ending.
os.print("\r\n");
os.flush();
| public void | log(java.lang.Object obj)Send one Object to the log
if (os == null)
return;
if (obj == null) {
// throw IllegalStateException??
return;
}
log(obj.toString());
|
|