KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > eventusermodel > AbortableHSSFListener


1 /* ====================================================================
2    Copyright 2003-2004 Apache Software Foundation
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 ==================================================================== */

16
17
18 package org.apache.poi.hssf.eventusermodel;
19
20 import org.apache.poi.hssf.record.Record;
21 import org.apache.poi.hssf.eventusermodel.HSSFUserException;
22
23 /**
24  * Interface for use with the HSSFRequest and HSSFEventFactory. Users should create
25  * a listener supporting this interface and register it with the HSSFRequest (associating
26  * it with Record SID's).
27  *
28  * @see org.apache.poi.hssf.eventusermodel.HSSFEventFactory
29  * @see org.apache.poi.hssf.eventusermodel.HSSFRequest
30  * @see org.apache.poi.hssf.eventusermodel.HSSFUserException
31  *
32  * @author Carey Sublette (careysub@earthling.net)
33  *
34  */

35
36 public abstract class AbortableHSSFListener implements HSSFListener
37 {
38     /**
39      * This method, inherited from HSSFListener is implemented as a stub.
40      * It is never called by HSSFEventFActory or HSSFRequest.
41      *
42      */

43      
44     public void processRecord(Record record)
45     {
46     }
47
48    /**
49      * Process an HSSF Record. Called when a record occurs in an HSSF file.
50      * Provides two options for halting the processing of the HSSF file.
51      *
52      * The return value provides a means of non-error termination with a
53      * user-defined result code. A value of zero must be returned to
54      * continue processing, any other value will halt processing by
55      * <code>HSSFEventFactory</code> with the code being passed back by
56      * its abortable process events methods.
57      *
58      * Error termination can be done by throwing the HSSFUserException.
59      *
60      * Note that HSSFEventFactory will not call the inherited process
61      *
62      * @return result code of zero for continued processing.
63      *
64      * @throws HSSFUserException User code can throw this to abort
65      * file processing by HSSFEventFactory and return diagnostic information.
66      */

67     public abstract short abortableProcessRecord(Record record) throws HSSFUserException;
68 }
69
Popular Tags