001 /**
002 *
003 * Copyright 2005 Protique Ltd
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 **/
018 package org.codehaus.activesoap.util;
019
020 import javanet.staxutils.XMLEventConsumerDelegate;
021 import javanet.staxutils.helpers.ListEventConsumer;
022
023 import javax.xml.stream.util.XMLEventConsumer;
024 import javax.xml.stream.XMLEventFactory;
025 import java.util.List;
026
027 /**
028 * Buffers up the events on the given input so that they can be replayed later on
029 *
030 * @version $Revision: 1.1 $
031 */
032 public class XMLStreamBuffer extends XMLEventConsumerDelegate {
033 private ListEventConsumer listConsumer;
034
035 public XMLStreamBuffer() {
036 this(new ListEventConsumer());
037 }
038
039 public XMLStreamBuffer(ListEventConsumer listConsumer) {
040 super(listConsumer);
041 this.listConsumer = listConsumer;
042 }
043
044 public XMLStreamBuffer(ListEventConsumer listConsumer, XMLEventFactory factory) {
045 super(listConsumer, factory);
046 this.listConsumer = listConsumer;
047 }
048
049 public List getEvents() {
050 return listConsumer.getEvents();
051 }
052
053 public void reset() {
054 listConsumer.reset();
055 }
056
057 public void setEvents(List events) {
058 listConsumer.setEvents(events);
059 }
060 }