com.ccg.net
Class SerializedCat

java.lang.Object
  extended by com.ccg.util.Convert
      extended by com.ccg.util.TagLookup
          extended by com.ccg.util.CommandLineUtility
              extended by com.ccg.net.URLCat
                  extended by com.ccg.net.SerializedCat
All Implemented Interfaces:
Lookup, Runnable

public class SerializedCat
extends URLCat

Command line utility read serialized Java objects retrieved.

This utility is useful to allow one to useful for determining information about a serialized data feed (or file).

It displays minimal information about each object read including:

Invoke via:

 java com.ccg.net.SerializedCat [-url URL|-in SRC] [-copy FILE] 
    [-useCache [true|false]] [-flush [true|false]]
 
-url URL
The source of the serialized objects (in a URL form recognized by URLCat. In addition to the standard file and URL's, you can also specify the "tcp://HOST:PORT/" URL for a direct TCP link to a serialized object server (the URLConnection class is loaded to provide this functionality). If you omit this argument, data will be read from the standard input.
-in SRC
The source (URL, file, of Java resource - recognized by the getInputStream() method used. In addition to the standard file and URL's, you can also specify the "tcp://HOST:PORT/" URL for a direct TCP link to a serialized object server (the URLConnection class is loaded to provide this functionality). If you omit this argument, data will be read from the standard input.
-copy DST
If you specify this option, a copy of EVERY object that was successfully deserialized will be written to the destination (DST) specified. You are allowed to specify any destination type (including "-", "out", "err") recognized by the method we use to create the destination (typically you'll just specify a file name).
-flush
Flushes received data as soon as its received (you'll see it immediately on the console). Less efficient, but useful in diagnostic situations.
-useCache [true|false]
Requests that we should try to use cached data if available (default is to disable the used of caches and try to fetch a fresh copy from the server).
-flush [true|false]
Flushes received data as soon as its received (you'll see it immediately on the console). Less efficient, but useful in diagnostic situations.
MORE
There are a few additional arguments that can be used. These are the standard arguments supplied by the parent CommandLineUtility class. They are not documented here as they may expand with time. The "-args URL" may be of particular interest as it allows one to load the command line arguments from a file/URL.

Quick example, suppose I have a TCP based service that writes out serialized Java object at port 12002 on the host 'kenny'. I could use the following to see what types of objects were being sent (and make a copy in log file called: "log.sobj"):

 java com.ccg.net.SerializedCat -in tcp://kenny:12002/ \
   -copy log.sobj
 

After running the above, you can re-run it against the log file created via (note, your log file may not have been closed out properly):

 java com.ccg.net.SerializedCat -in log.sobj
 

Since:
1.0
Version:
$Revision: 1.3 $
Author:
$Author: pkb $

Constructor Summary
SerializedCat(String[] args)
          Constructs the object with a set of command line arguments.
 
Method Summary
static void main(String[] args)
          Main entry point into the application.
 void run()
          Does the actual reading and processing of the information.
 
Methods inherited from class com.ccg.net.URLCat
getURLInputStream, getUseCaches, isFlushEnabled, isHexDump, setFlushEnabled, setHexDump, setUseCaches
 
Methods inherited from class com.ccg.util.CommandLineUtility
getFiles, getInputStream, getLineNumberReader, getOutputStream, getPrintWriter, getStrings, setInputStream, setOutputStream
 
Methods inherited from class com.ccg.util.TagLookup
get, getBoolean, getChoice, getColor, getDate, getDate, getFont, getIndexedList, getInputStream, getLocale, getLookup, getNumber, getNumber, getOutputStream, getString, getString, getStrings, getTag, getTimeSpan, getTimeSpan, setLookup, setTag
 
Methods inherited from class com.ccg.util.Convert
choiceValue, getDateFormat, getNumberFormat, setDateFormat, setNumberFormat, toBoolean, toColor, toDate, toFont, toInputStream, toLocale, toNumber, toOutputStream, toString, toTimeSpan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializedCat

public SerializedCat(String[] args)
Constructs the object with a set of command line arguments.

This method constructs a new SerializedCat object and initializes with a array of string values which are treated as command line arguments. The command line arguments are processed (as specified in the class overview and parent class).

Parameters:
args - Array of command line arguments.
Since:
1.0
Method Detail

run

public void run()
Does the actual reading and processing of the information.

This method is responsible for the actual reading and processing of the serialized objects from the specified source as described in the class overview.

Specified by:
run in interface Runnable
Overrides:
run in class URLCat
Since:
1.0

main

public static void main(String[] args)
Main entry point into the application.

Simply constructs the object and passes control to the run() method.

Parameters:
args - Array of command line arguments.


Copyright 1998-1998-2006 null. All Rights Reserved.