src/java.xml/share/classes/javax/xml/parsers/SAXParser.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -551,6 +551,55 @@
             + "\" version \""
             + this.getClass().getPackage().getSpecificationVersion()
             + "\""
             );
     }
+
+
+    /**
+     * Stops the parsing process.
+     * <p>
+     * This method can be called anywhere from any event method of a SAX
+     * handler. Once called, it does not terminate the parsing process
+     * immediately. Instead, it will continue finishing and returning the
+     * current event, and marking the state before it stops parsing. The
+     * parsing state is maintained after the process is stopped.
+     * <p>
+     * The event from which the method is called is considered parsed. In case
+     * the parsing process is subsequently resumed, it will start at the next
+     * event.
+     *
+     * @implSpec
+     * The method in the {@code javax.xml.parsers} API does nothing and returns
+     * false by default. Implementations that implement this method may choose
+     * to continue to a state for possible resumption of the operation. It is
+     * recommended that the current event be returned before terminating
+     * the parsing process.
+     * <p>
+     * The method shall return true once it has notified the parser to stop
+     * parsing.
+     *
+     * @return true if the parsing process can be stopped, false otherwise
+     */
+    public boolean stop() {
+        return false;
+    }
+
+    /**
+     * Resumes the parsing process that has been stopped by the {@link #stop()}
+     * method. The method will simply return if parsing is not stopped.
+     *
+     * @implSpec
+     * The method in the {@code javax.xml.parsers} API does nothing and returns
+     * false by default. Implementations that implement this method shall
+     * check the state to determine whether the parsing process can be resumed.
+     * It shall return true after it restarted the parsing regardless of what
+     * may happen in the rest of the parsing process, that is, the return value
+     * only indicates that the parsing can be and has been resumed.
+     *
+     * @return true if the parsing process is resumed successfully, false
+     * otherwise
+     */
+    public boolean resume() {
+        return false;
+    }
 }