Source code: org/apache/derby/iapi/services/stream/HeaderPrintWriter.java
1 /*
2
3 Derby - Class org.apache.derby.iapi.services.stream.HeaderPrintWriter
4
5 Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19 */
20
21 package org.apache.derby.iapi.services.stream;
22
23 import java.io.PrintWriter;
24
25 /**
26 * A HeaderPrintWriter is like a PrintWriter with support for
27 * including a header in the output. It is expected users
28 * will use HeaderPrintWriters to prepend headings to trace
29 * and log messages.
30 *
31 */
32 public interface HeaderPrintWriter
33 {
34 /**
35 * Puts out some setup info for
36 * the current write and the write(s) that will be put out next.
37 * It ends with a \n\r.
38 * <p>
39 * All other writes to the stream use the
40 * PrintStream interface.
41 */
42 public void printlnWithHeader(String message);
43
44 /**
45 * Return the header for the stream.
46 */
47 public PrintWriterGetHeader getHeader();
48
49 /**
50 * Gets a PrintWriter object for writing to this HeaderPrintWriter.
51 * Users may use the HeaderPrintWriter to access methods not included
52 * in this interface or to invoke methods or constructors which require
53 * a PrintWriter.
54 *
55 * Interleaving calls to a printWriter and its associated HeaderPrintWriter
56 * is not supported.
57 *
58 */
59 public PrintWriter getPrintWriter();
60
61 /**
62 * Gets the name of the wrapped writer or stream
63 */
64 public String getName ();
65
66 /*
67 * The routines that mimic java.io.PrintWriter...
68 */
69 /**
70 * @see java.io.PrintWriter#print
71 */
72 public void print(String message);
73
74 /**
75 * @see java.io.PrintWriter#println
76 */
77 public void println(String message);
78
79 /**
80 * @see java.io.PrintWriter#println
81 */
82 public void println(Object message);
83
84 /**
85 * @see java.io.PrintWriter#flush
86 */
87 public void flush();
88 }
89