com.alien.enterpriseRFID.externalio
Class ExternalIOUtil

java.lang.Object
  extended bycom.alien.enterpriseRFID.externalio.ExternalIOUtil

public class ExternalIOUtil
extends java.lang.Object

ExternalIOUtil provides utility methods for parsing XML- and text-based IOlists from the reader into ExternalIO objects and arrays of ExternalIOs. Decoding and parsing of custom-formatted IOLists is not supported.

Version:
0.1 Feb 2007
Author:
David Krull

Field Summary
static java.text.SimpleDateFormat DATE_FORMATTER
           
 
Constructor Summary
ExternalIOUtil()
          Constructor is not required, since all fields and methods are declared static.
 
Method Summary
static ExternalIO decodeIO(java.lang.String ioLine)
          Decode a single text-based line of IOList data into a single ExternalIO item.
static ExternalIO[] decodeIOList(java.lang.String ioLines)
          Decodes a text-based IOList message from a reader into an array of ExternalIOs.
static ExternalIO decodeXMLIO(java.lang.String xmlData)
          Decode an individual ExternalIO event from an XML-based iolist message.
static ExternalIO[] decodeXMLIOList(java.lang.String xmlData)
          Decodes an XML-based IOList message from a reader into an array of ExternalIOs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_FORMATTER

public static final java.text.SimpleDateFormat DATE_FORMATTER
Constructor Detail

ExternalIOUtil

public ExternalIOUtil()
Constructor is not required, since all fields and methods are declared static. For instance, to use the decodeXMLIOList() method, simply call ExternalIOUtil.decodeXMLIOList().

Method Detail

decodeXMLIOList

public static ExternalIO[] decodeXMLIOList(java.lang.String xmlData)
Decodes an XML-based IOList message from a reader into an array of ExternalIOs. The xmlData that is passed in should be of the form:
   <?xml version="1.0" encoding="UTF-8"?>
   <Alien-RFID-IO-List>
   <Alien-RFID-IO>
     <Type>DI</Type>
     <Time>2007/02/12 11:10:47.531</Time>
     <Data>0</Data>
   </Alien-RFID-IO>
   <Alien-RFID-IO>
     <Type>DO</Type>
     <Time>2007/02/12 11:10:57.965</Time>
     <Data>5</Data>
   </Alien-RFID-IO>
   </Alien-RFID-IO-List>
 

Parameters:
xmlData - the XML string to be parsed and decoded
Returns:
an array of ExternalIO objects, or null if there are no IOs in the IOList

decodeXMLIO

public static ExternalIO decodeXMLIO(java.lang.String xmlData)
Decode an individual ExternalIO event from an XML-based iolist message. The information should be of the form:
   <Alien-RFID-IO>
     <Type>DI</Type>
     <Time>2007/02/12 11:10:47.531</Time>
     <Data>0</Data>
   </Alien-RFID-IO>
 

Parameters:
xmlData - the XML string containing the ExternalIO information to be parsed
Returns:
a single ExternalIO object, or null if the event could not be decoded

decodeIOList

public static ExternalIO[] decodeIOList(java.lang.String ioLines)
Decodes a text-based IOList message from a reader into an array of ExternalIOs. The string data that is passed in should be of the form:
IO:DO, Time:2007/02/12 16:24:56.682, Data:6
IO:DI, Time:2007/02/12 16:24:56.712, Data:3

Parameters:
ioLines - the multi-line String containing text-based IOList data
Returns:
an array of ExternalIO objects, or null if there is no valid data in the ioLines

decodeIO

public static ExternalIO decodeIO(java.lang.String ioLine)
Decode a single text-based line of IOList data into a single ExternalIO item. The string data that is passed in should be of the form:
IO:DO, Time:2007/02/12 16:24:56.682, Data:6
IO:DI, Time:2007/02/12 16:24:56.712, Data:3

Parameters:
ioLine - the line of text-based IOList data to be parsed
Returns:
a single ExternalIO object, or null if there is no valid IOList data