Author: jbq
Date: Mon Mar  5 07:48:54 2007
New Revision: 514702

URL: http://svn.apache.org/viewvc?view=rev&rev=514702
Log:
Catch up with revision 461785 applied in trunk:

* Deprecate parse(IResourceStream) removed in trunk
* Adding parse(InputStream, String)

See http://svn.apache.org/viewvc?view=rev&revision=461785

Modified:
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupParser.java
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/IXmlPullParser.java
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/XmlPullParser.java

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupParser.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupParser.java?view=diff&rev=514702&r1=514701&r2=514702
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupParser.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupParser.java
 Mon Mar  5 07:48:54 2007
@@ -192,7 +192,7 @@
                this.markup.setResource(resource);
 
                // Initialize the xml parser
-               this.xmlParser.parse(resource, 
this.markupSettings.getDefaultMarkupEncoding());
+               this.xmlParser.parse(resource.getInputStream(), 
this.markupSettings.getDefaultMarkupEncoding());
 
                // parse the xml markup and tokenize it into wicket relevant 
markup
                // elements

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/IXmlPullParser.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/IXmlPullParser.java?view=diff&rev=514702&r1=514701&r2=514702
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/IXmlPullParser.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/IXmlPullParser.java
 Mon Mar  5 07:48:54 2007
@@ -17,6 +17,7 @@
 package wicket.markup.parser;
 
 import java.io.IOException;
+import java.io.InputStream;
 
 import wicket.util.resource.IResourceStream;
 import wicket.util.resource.ResourceStreamNotFoundException;
@@ -98,11 +99,44 @@
         *             Error while reading the resource
         * @throws ResourceStreamNotFoundException
         *             Resource not found
+        * 
+        * @deprecated Removed in 2.0
         */
        public abstract void parse(final IResourceStream resource, final String 
encoding)
                        throws IOException, ResourceStreamNotFoundException;
 
        /**
+        * Reads and parses markup from an input stream, using UTF-8 encoding by
+        * default when not specified in XML declaration. Use nextTag() to 
access
+        * the tags contained, one after another.
+        * 
+        * @param inputStream
+        *            The input stream to read and parse
+        * @throws IOException
+        *             Error while reading the resource
+        * @throws ResourceStreamNotFoundException
+        *             Resource not found
+        */
+       public abstract void parse(final InputStream inputStream) throws 
IOException,
+                       ResourceStreamNotFoundException;
+
+       /**
+        * Reads and parses markup from an input stream. Use nextTag() to 
access the
+        * tags contained, one after another.
+        * 
+        * @param inputStream
+        *            A resource like e.g. a file
+        * @param encoding
+        *            Use null to apply JVM/OS default
+        * @throws IOException
+        *             Error while reading the resource
+        * @throws ResourceStreamNotFoundException
+        *             Resource not found
+        */
+       public abstract void parse(final InputStream inputStream, final String 
encoding)
+                       throws IOException, ResourceStreamNotFoundException;
+
+       /**
         * Set the position marker of the markup at the current position.
         */
        public abstract void setPositionMarker();
@@ -113,4 +147,4 @@
         * @param pos
         */
        public abstract void setPositionMarker(final int pos);
-}
\ No newline at end of file
+}

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/XmlPullParser.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/XmlPullParser.java?view=diff&rev=514702&r1=514701&r2=514702
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/XmlPullParser.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/parser/XmlPullParser.java
 Mon Mar  5 07:48:54 2007
@@ -374,6 +374,8 @@
         *            Default character encoding to use when not specified in 
XML declaration, specify null to use JVM default
         * @throws IOException
         * @throws ResourceStreamNotFoundException
+        * 
+        * @deprecated Removed in 2.0
         */
        public void parse(final IResourceStream resource, final String 
encoding) throws IOException,
                        ResourceStreamNotFoundException
@@ -392,7 +394,8 @@
        }
 
        /**
-        * Reads and parses markup from an input stream
+        * Reads and parses markup from an input stream, using UTF-8 encoding by
+        * default when not specified in XML declaration.
         * 
         * @param in
         *            The input stream to read and parse
@@ -402,16 +405,32 @@
        public void parse(final InputStream in) throws IOException,
                        ResourceStreamNotFoundException
        {
+               // When XML declaration does not specify encoding, it defaults 
to UTF-8
+               parse(in, "UTF-8");
+       }
+
+       /**
+        * Reads and parses markup from an input stream
+        * 
+        * @param inputStream
+        *            The input stream to read and parse
+        * @param encoding
+        *            The default character encoding of the input
+        * @throws IOException
+        * @throws ResourceStreamNotFoundException
+        */
+       public void parse(final InputStream inputStream, final String encoding) 
throws IOException,
+                       ResourceStreamNotFoundException
+       {
                try
                {
-                       // When XML declaration does not specify encoding, it 
defaults to UTF-8
                        this.xmlReader = new XmlReader(
-                                       new BufferedInputStream(in, 4000), 
"UTF-8");
+                                       new BufferedInputStream(inputStream, 
4000), encoding);
                        this.input = new FullyBufferedReader(this.xmlReader);
                }
                finally
                {
-                       in.close();
+                       inputStream.close();
                        if(this.xmlReader != null) this.xmlReader.close();
                }
        }


Reply via email to