FileDocCategorySizeDatePackage
NetLog.javaAPI DocExample1603Sun Feb 15 20:44:44 GMT 2004None

NetLog

public class NetLog extends Object
NetLog - NetLog client API.
see
NetLogSimple -- demonstration example usage.
author
Ian Darwin, http://www.darwinsys.com/
version
Copyright (C) 1995, 1996 Ian Darwin

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 voidclose()
Close the log.

		os.close();
		os = null;
	
public voidlog(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 voidlog(java.lang.Object obj)
Send one Object to the log

		if (os == null)
			return;
		if (obj == null) {
			// throw IllegalStateException??
			return;
		}
		log(obj.toString());