SockStreamLoggerpublic class SockStreamLogger extends Object
Fields Summary |
---|
public static boolean | LOG_SIZE | public static boolean | LOG_MESSAGE | public static long | DELAY | public static long | READ_DELAY | public static int | WriteCount | public static int | ReadCount | public static int | WriteSize | public static int | ReadSize |
Methods Summary |
---|
public static void | log(boolean isWritten, java.net.Socket so, int sz, byte[] buf, int off)
if (LOG_SIZE)
{
System.err.print("Message of size ");
System.err.print(sz);
System.err.print(isWritten ? " written" : " read");
System.err.print(" by Socket ");
System.err.println(so);
}
if (LOG_MESSAGE)
System.err.println(new String(buf, off, sz));
| public static void | read(java.net.Socket so, int sz, byte[] buf, int off)
log(false, so, sz, buf, off);
ReadCount++;
ReadSize += sz;
if(READ_DELAY != -1) try{Thread.sleep(READ_DELAY);}catch(Exception e){}
| public static void | written(java.net.Socket so, int sz, byte[] buf, int off)
log(true, so, sz, buf, off);
WriteCount++;
WriteSize += sz;
if(DELAY != -1) try{Thread.sleep(DELAY);}catch(Exception e){}
|
|