Coverage Report - org.simpleframework.xml.stream.Provider
 
Classes in this File Line Coverage Branch Coverage Complexity
Provider
N/A
N/A
1
 
 1  
 /*
 2  
  * Provider.java January 2010
 3  
  *
 4  
  * Copyright (C) 2010, Niall Gallagher <niallg@users.sf.net>
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
 15  
  * implied. See the License for the specific language governing 
 16  
  * permissions and limitations under the License.
 17  
  */
 18  
 
 19  
 package org.simpleframework.xml.stream;
 20  
 
 21  
 import java.io.InputStream;
 22  
 import java.io.Reader;
 23  
 
 24  
 /**
 25  
  * The <code>Provider</code> object is used to represent the provider
 26  
  * of an XML parser. All XML parsers are represented as an event
 27  
  * reader much like the StAX event reader. Providing a interface to
 28  
  * the parser in this manner ensures that the core framework is not
 29  
  * coupled to any specific implementation and also ensures that it
 30  
  * should run in multiple environments that may support specific XML
 31  
  * parsers. 
 32  
  * 
 33  
  * @author Niall Gallagher
 34  
  * 
 35  
  * @see org.simpleframework.xml.stream.NodeBuilder
 36  
  */
 37  
 interface Provider {
 38  
 
 39  
    /**
 40  
     * This provides an <code>EventReader</code> that will read from
 41  
     * the specified input stream. When reading from an input stream
 42  
     * the character encoding should be taken from the XML prolog or
 43  
     * it should default to the UTF-8 character encoding.
 44  
     * 
 45  
     * @param source this is the stream to read the document with
 46  
     * 
 47  
     * @return this is used to return the event reader implementation
 48  
     */
 49  
    EventReader provide(InputStream source) throws Exception;
 50  
    
 51  
    /**
 52  
     * This provides an <code>EventReader</code> that will read from
 53  
     * the specified reader. When reading from a reader the character
 54  
     * encoding should be the same as the source XML document.
 55  
     * 
 56  
     * @param source this is the reader to read the document with
 57  
     * 
 58  
     * @return this is used to return the event reader implementation
 59  
     */
 60  
    EventReader provide(Reader source) throws Exception;
 61  
 }