Top Description Fields Constructors Methods
org.apache.derby.impl.services.stream

pack-priv Class BasicHeaderPrintWriter

extends PrintWriter
implements HeaderPrintWriter
Class Inheritance
All Implemented Interfaces
org.apache.derby.shared.common.stream.HeaderPrintWriter
Imports
org.apache.derby.shared.common.stream.HeaderPrintWriter, .PrintWriterGetHeader, java.io.PrintWriter, .Writer, .OutputStream

Basic class to print lines with headers.

STUB: Should include code to emit a new line before a header which is not the first thing on the line.

Field Summary

Modifier and TypeField and Description
private final boolean
private final PrintWriterGetHeader
private final String
Inherited from java.io.PrintWriter:
out

Constructor Summary

AccessConstructor and Description
pack-priv
BasicHeaderPrintWriter(OutputStream
Where to write to.
writeTo
,
PrintWriterGetHeader
Object to get headers for output lines.
headerGetter
,
boolean
If true, complete will also close writeTo
canClose
,
String
Name of writeTo, e.g. a file name
streamName
)

the constructor sets up the HeaderPrintWriter.

pack-priv
BasicHeaderPrintWriter(Writer
Where to write to.
writeTo
,
PrintWriterGetHeader
Object to get headers for output lines.
headerGetter
,
boolean
If true, complete will also close writeTo
canClose
,
String
Name of writeTo, e.g. a file name
writerName
)

the constructor sets up the HeaderPrintWriter.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
complete()

Flushes stream, and optionally also closes it if constructed with canClose equal to true.

public PrintWriterGetHeader
public String
getName()

Implements org.apache.derby.shared.common.stream.HeaderPrintWriter.getName.

Gets the name of the wrapped writer or stream

public PrintWriter
getPrintWriter()

Implements org.apache.derby.shared.common.stream.HeaderPrintWriter.getPrintWriter.

Gets a PrintWriter object for writing to this HeaderPrintWriter.

public synchronized void
printlnWithHeader(String
Message to print
message
)

Implements org.apache.derby.shared.common.stream.HeaderPrintWriter.printlnWithHeader.

Puts out some setup info for the current write and the write(s) that will be put out next.

Inherited from java.io.PrintWriter:
appendappendappendcheckErrorclearErrorcloseflushformatformatprintprintprintprintprintprintprintprintprintprintfprintfprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnsetErrorwritewritewritewritewrite

Field Detail

canCloseback to summary
private final boolean canClose
headerGetterback to summary
private final PrintWriterGetHeader headerGetter
nameback to summary
private final String name

Constructor Detail

BasicHeaderPrintWriterback to summary
pack-priv BasicHeaderPrintWriter(OutputStream writeTo, PrintWriterGetHeader headerGetter, boolean canClose, String streamName)

the constructor sets up the HeaderPrintWriter.

Parameters
writeTo:OutputStream

Where to write to.

headerGetter:PrintWriterGetHeader

Object to get headers for output lines.

canClose:boolean

If true, complete will also close writeTo

streamName:String

Name of writeTo, e.g. a file name

See Also
PrintWriterGetHeader
BasicHeaderPrintWriterback to summary
pack-priv BasicHeaderPrintWriter(Writer writeTo, PrintWriterGetHeader headerGetter, boolean canClose, String writerName)

the constructor sets up the HeaderPrintWriter.

Parameters
writeTo:Writer

Where to write to.

headerGetter:PrintWriterGetHeader

Object to get headers for output lines.

canClose:boolean

If true, complete will also close writeTo

writerName:String

Name of writeTo, e.g. a file name

See Also
PrintWriterGetHeader

Method Detail

completeback to summary
pack-priv void complete()

Flushes stream, and optionally also closes it if constructed with canClose equal to true.

getHeaderback to summary
public PrintWriterGetHeader getHeader()

Implements org.apache.derby.shared.common.stream.HeaderPrintWriter.getHeader.

Doc from org.apache.derby.shared.common.stream.HeaderPrintWriter.getHeader.

Return the header for the stream.

Returns:PrintWriterGetHeader

the stream header

getNameback to summary
public String getName()

Implements org.apache.derby.shared.common.stream.HeaderPrintWriter.getName.

Doc from org.apache.derby.shared.common.stream.HeaderPrintWriter.getName.

Gets the name of the wrapped writer or stream

Returns:String

the name of the wrapped writer or stream

getPrintWriterback to summary
public PrintWriter getPrintWriter()

Implements org.apache.derby.shared.common.stream.HeaderPrintWriter.getPrintWriter.

Doc from org.apache.derby.shared.common.stream.HeaderPrintWriter.getPrintWriter.

Gets a PrintWriter object for writing to this HeaderPrintWriter. Users may use the HeaderPrintWriter to access methods not included in this interface or to invoke methods or constructors which require a PrintWriter. Interleaving calls to a printWriter and its associated HeaderPrintWriter is not supported.

Returns:PrintWriter

the print machinery

printlnWithHeaderback to summary
public synchronized void printlnWithHeader(String message)

Implements org.apache.derby.shared.common.stream.HeaderPrintWriter.printlnWithHeader.

Doc from org.apache.derby.shared.common.stream.HeaderPrintWriter.printlnWithHeader.

Puts out some setup info for the current write and the write(s) that will be put out next. It ends with a \n\r.

All other writes to the stream use the PrintStream interface.

Parameters
message:String

Message to print