public Vector decodeEvents(final String document) {

      if (document != null) {

          if (document.trim().equals("")) {
              return null;
          }

          String newDoc;
          String newPartialEvent = null;
          //separate the string into the last portion ending with </record>
          // (which will be processed) and the partial event which
          // will be combined and processed in the next section

          //if the document does not contain a record end,
          // append it to the partial event string
          if (document.lastIndexOf(RECORD_END) == -1) {
              partialEvent = partialEvent + document;
              return null;
          }

          if (document.lastIndexOf(RECORD_END) + RECORD_END.length()
                  < document.length()) {
              newDoc = document.substring(0,
                      document.lastIndexOf(RECORD_END) + RECORD_END.length());
              newPartialEvent = document.substring(
                      document.lastIndexOf(RECORD_END) + RECORD_END.length());
          } else {
              newDoc = document;
          }
          if (partialEvent != null) {
              newDoc = partialEvent + newDoc;
          }
          partialEvent = newPartialEvent;

          Document doc = parse(newDoc);
          if (doc == null) {
              return null;
          }
          return decodeEvents(doc);
      }
      return null;
  }
public Vector decodeEvents ( final String document ) { if ( document != null ) { if ( document . trim ( ) . equals ( "" ) ) { return null ; } String newDoc ; String newPartialEvent = null ; if ( document . lastIndexOf ( RECORD_END ) == - 1 ) { partialEvent = partialEvent + document ; return null ; } if ( document . lastIndexOf ( RECORD_END ) + RECORD_END . length ( ) < document . length ( ) ) { newDoc = document . substring ( 0 , document . lastIndexOf ( RECORD_END ) + RECORD_END . length ( ) ) ; newPartialEvent = document . substring ( document . lastIndexOf ( RECORD_END ) + RECORD_END . length ( ) ) ; } else { newDoc = document ; } if ( partialEvent != null ) { newDoc = partialEvent + newDoc ; } partialEvent = newPartialEvent ; Document doc = parse ( newDoc ) ; if ( doc == null ) { return null ; } return decodeEvents ( doc ) ; } return null ; }
Decodes a String representing a number of events into a
Vector of LoggingEvents.
@param document to decode events from
@return Vector of LoggingEvents