org.mbari.siam.operations.utils
Class DeviceLogUtil

java.lang.Object
  extended by org.mbari.siam.operations.utils.DeviceLogUtil

public class DeviceLogUtil
extends java.lang.Object

Print DeviceLog contents.


Nested Class Summary
 class DeviceLogUtil.PacketFormat
           
 
Field Summary
protected static org.apache.log4j.Logger _log4j
          Log4j logger
 
Constructor Summary
DeviceLogUtil()
           
 
Method Summary
static void check(DeviceLog log, boolean repair)
           
protected static void convertToAscii(byte[] buffer)
          Utility method used in subclass' toString() methods.
static java.lang.String findReplace(java.lang.String str, java.lang.String find, java.lang.String replace)
          Replace substring find with substring replace in the specified string str Useful for replacing escape characters and general find/replace.
 java.lang.String formatHeader(DevicePacket packet, DeviceLogUtil.PacketFormat format)
          format a header
 java.lang.String getStatsHeader()
           
protected static boolean isPrintable(byte c)
          Utility method; return true if byte is printable.
static void main(java.lang.String[] args)
           
 java.lang.String parseHeader(DevicePacket packet)
          parse out just the header from a packet
 void printPackets(DeviceLog log, long startTime, long stopTime, PacketFilter[] packetFilters, PacketParser parser)
          Print ascii representation of packets in log, selecting which packets to print based on input criteria.
 void printPackets(DeviceLog log, long startTime, long stopTime, PacketFilter[] packetFilters, java.lang.String convertBinary, boolean convertTime, PacketParser parser, boolean showStats, boolean showData, boolean statsHeaders)
           
 void setPacketFormat(java.lang.String dataFormat, java.lang.String headerSeparator, java.lang.String recordSeparator, boolean doDefault, boolean doTimeLong, boolean doTimeDate, boolean doPacketType, boolean doData, boolean doStats, boolean doStatsHeader)
           
static java.lang.String unescape(java.lang.String str, java.lang.String find, int len, int radix)
          Replace escaped hex, octal or unicode characters with the appropriate character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j
Log4j logger

Constructor Detail

DeviceLogUtil

public DeviceLogUtil()
Method Detail

printPackets

public void printPackets(DeviceLog log,
                         long startTime,
                         long stopTime,
                         PacketFilter[] packetFilters,
                         PacketParser parser)
                  throws java.lang.Exception
Print ascii representation of packets in log, selecting which packets to print based on input criteria.

Parameters:
log -
startTime - Print packets with timestamp later than this
stopTime - Print packets with timestamp earlier than this
packetFilters - 1=ALL_TYPES, 2=SENSORDATA, 3=METADATA, 4=MESSAGE
parser -
Throws:
java.lang.Exception

printPackets

public void printPackets(DeviceLog log,
                         long startTime,
                         long stopTime,
                         PacketFilter[] packetFilters,
                         java.lang.String convertBinary,
                         boolean convertTime,
                         PacketParser parser,
                         boolean showStats,
                         boolean showData,
                         boolean statsHeaders)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getStatsHeader

public java.lang.String getStatsHeader()

isPrintable

protected static boolean isPrintable(byte c)
Utility method; return true if byte is printable.


convertToAscii

protected static void convertToAscii(byte[] buffer)
Utility method used in subclass' toString() methods.


setPacketFormat

public void setPacketFormat(java.lang.String dataFormat,
                            java.lang.String headerSeparator,
                            java.lang.String recordSeparator,
                            boolean doDefault,
                            boolean doTimeLong,
                            boolean doTimeDate,
                            boolean doPacketType,
                            boolean doData,
                            boolean doStats,
                            boolean doStatsHeader)

formatHeader

public java.lang.String formatHeader(DevicePacket packet,
                                     DeviceLogUtil.PacketFormat format)
format a header


parseHeader

public java.lang.String parseHeader(DevicePacket packet)
parse out just the header from a packet


findReplace

public static java.lang.String findReplace(java.lang.String str,
                                           java.lang.String find,
                                           java.lang.String replace)
Replace substring find with substring replace in the specified string str Useful for replacing escape characters and general find/replace.


unescape

public static java.lang.String unescape(java.lang.String str,
                                        java.lang.String find,
                                        int len,
                                        int radix)
Replace escaped hex, octal or unicode characters with the appropriate character. Syntax for escaped characters is as follows: hex: \\xnn, n=0-9a-f oct: \\onnn, n=0-7 uni: \\unnnn, n=0-9a-f

Parameters:
str - the string containing escaped characters
find - the escape sequence to find (e.g. "\\x")
len - the number of characters following escape sequence (hex:2, unicode:4, octal:3)
radix - the radix to use for parsing the escape sequence
Returns:
returns a string containing the specified substitution

check

public static void check(DeviceLog log,
                         boolean repair)

main

public static void main(java.lang.String[] args)


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.