01: /*
02:
03: Derby - Class org.apache.derby.iapi.services.stream.HeaderPrintWriter
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.iapi.services.stream;
23:
24: import java.io.PrintWriter;
25:
26: /**
27: * A HeaderPrintWriter is like a PrintWriter with support for
28: * including a header in the output. It is expected users
29: * will use HeaderPrintWriters to prepend headings to trace
30: * and log messages.
31: *
32: */
33: public interface HeaderPrintWriter {
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: }
|