01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id$ */
19:
20: package org.apache.xmlgraphics.ps.dsc;
21:
22: import java.io.IOException;
23:
24: import org.apache.xmlgraphics.ps.dsc.events.DSCComment;
25:
26: /**
27: * Interface containing events generated by the DSCParser. Applications can implement this
28: * interface to react to certain events.
29: */
30: public interface DSCHandler {
31:
32: /**
33: * Called as a new PostScript file starts.
34: * @param header the first line of the DSC-compliant file
35: * @throws IOException In case of an I/O error
36: */
37: public void startDocument(String header) throws IOException;
38:
39: /**
40: * Called when the PostScript file is fully processed, i.e. after the %%EOF comment.
41: * @throws IOException In case of an I/O error
42: */
43: public void endDocument() throws IOException;
44:
45: /**
46: * Called for each standard DSC comment. The classes passed to this method may be simple
47: * DSCComment classes or special subclasses for some of the DSC comments.
48: * @param comment the DSC comment
49: * @throws IOException In case of an I/O error
50: */
51: public void handleDSCComment(DSCComment comment) throws IOException;
52:
53: /**
54: * Called for a normal line of PostScript code.
55: * @param line the line of code
56: * @throws IOException In case of an I/O error
57: */
58: public void line(String line) throws IOException;
59:
60: /**
61: * Called for any line containing a full-line PostScript comment. This is also called for
62: * custom comments following the extension mechanism of the DSC specification.
63: * @param comment the comment line
64: * @throws IOException In case of an I/O error
65: */
66: public void comment(String comment) throws IOException;
67:
68: }
|