Top Description Fields Constructors Methods
org.mortbay.io

public Class UncheckedPrintWriter

extends PrintWriter
Class Inheritance
Imports
java.io.BufferedWriter, .InterruptedIOException, .IOException, .OutputStream, .OutputStreamWriter, .PrintWriter, .Writer, org.mortbay.log.Log

A wrapper for the java.io.PrintWriter that re-throws the instances of java.io.IOException thrown by the underlying implementation of java.io.Writer as RunimeIOException instances.

Field Summary

Modifier and TypeField and Description
private boolean
private String
lineSeparator

Line separator string.

Inherited from java.io.PrintWriter:
out

Constructor Summary

AccessConstructor and Description
public
public
UncheckedPrintWriter(Writer
A character-output stream
out
,
boolean
A boolean; if true, the println() methods will flush the output buffer
autoFlush
)

Create a new PrintWriter.

public
UncheckedPrintWriter(OutputStream
An output stream
out
)

Create a new PrintWriter, without automatic line flushing, from an existing OutputStream.

public
UncheckedPrintWriter(OutputStream
An output stream
out
,
boolean
A boolean; if true, the println() methods will flush the output buffer
autoFlush
)

Create a new PrintWriter from an existing OutputStream.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.PrintWriter.close.

Implements java.io.Closeable.close.

Close the stream.
public void
flush()

Overrides java.io.PrintWriter.flush.

Implements java.io.Flushable.flush.

Flush the stream.
private void
isOpen()

Check to make sure that the stream has not been closed

private void
public void
println()

Overrides java.io.PrintWriter.println.

Terminate the current line by writing the line separator string.
public void
println(boolean
the boolean value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print a boolean value and then terminate the line.
public void
println(char
the char value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print a character and then terminate the line.
public void
println(int
the int value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print an integer and then terminate the line.
public void
println(long
the long value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print a long integer and then terminate the line.
public void
println(float
the float value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print a floating-point number and then terminate the line.
public void
println(double
the double value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print a double-precision floating-point number and then terminate the line.
public void
println(char[]
the array of char values to be printed
x
)

Overrides java.io.PrintWriter.println.

Print an array of characters and then terminate the line.
public void
println(String
the String value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print a String and then terminate the line.
public void
println(Object
the Object value to be printed
x
)

Overrides java.io.PrintWriter.println.

Print an Object and then terminate the line.
public void
write(int
int specifying a character to be written.
c
)

Overrides java.io.PrintWriter.write.

Write a single character.
public void
write(char[]
Array of characters
buf
,
int
Offset from which to start writing characters
off
,
int
Number of characters to write
len
)

Overrides java.io.PrintWriter.write.

Write a portion of an array of characters.
public void
write(char[]
Array of characters to be written
buf
)

Overrides java.io.PrintWriter.write.

Write an array of characters.
public void
write(String
A String
s
,
int
Offset from which to start writing characters
off
,
int
Number of characters to write
len
)

Overrides java.io.PrintWriter.write.

Write a portion of a string.
public void
write(String
String to be written
s
)

Overrides java.io.PrintWriter.write.

Write a string.
Inherited from java.io.PrintWriter:
appendappendappendcheckErrorclearErrorformatformatprintfprintfsetError

Field Detail

autoFlushback to summary
private boolean autoFlush

Hides java.io.PrintWriter.autoFlush.

lineSeparatorback to summary
private String lineSeparator

Line separator string. This is the value of the line.separator property at the moment that the stream was created.

Constructor Detail

UncheckedPrintWriterback to summary
public UncheckedPrintWriter(Writer out)
UncheckedPrintWriterback to summary
public UncheckedPrintWriter(Writer out, boolean autoFlush)

Create a new PrintWriter.

Parameters
out:Writer

A character-output stream

autoFlush:boolean

A boolean; if true, the println() methods will flush the output buffer

UncheckedPrintWriterback to summary
public UncheckedPrintWriter(OutputStream out)

Create a new PrintWriter, without automatic line flushing, from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.

Parameters
out:OutputStream

An output stream

See Also
java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream)
UncheckedPrintWriterback to summary
public UncheckedPrintWriter(OutputStream out, boolean autoFlush)

Create a new PrintWriter from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.

Parameters
out:OutputStream

An output stream

autoFlush:boolean

A boolean; if true, the println() methods will flush the output buffer

See Also
java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream)

Method Detail

closeback to summary
public void close()

Overrides java.io.PrintWriter.close.

Implements java.io.Closeable.close.

Close the stream.

flushback to summary
public void flush()

Overrides java.io.PrintWriter.flush.

Implements java.io.Flushable.flush.

Flush the stream.

isOpenback to summary
private void isOpen() throws IOException

Check to make sure that the stream has not been closed

newLineback to summary
private void newLine()

Hides java.io.PrintWriter.newLine.

printlnback to summary
public void println()

Overrides java.io.PrintWriter.println.

Terminate the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').

printlnback to summary
public void println(boolean x)

Overrides java.io.PrintWriter.println.

Print a boolean value and then terminate the line. This method behaves as though it invokes print(boolean) and then println().

Parameters
x:boolean

the boolean value to be printed

printlnback to summary
public void println(char x)

Overrides java.io.PrintWriter.println.

Print a character and then terminate the line. This method behaves as though it invokes print(char) and then println().

Parameters
x:char

the char value to be printed

printlnback to summary
public void println(int x)

Overrides java.io.PrintWriter.println.

Print an integer and then terminate the line. This method behaves as though it invokes print(int) and then println().

Parameters
x:int

the int value to be printed

printlnback to summary
public void println(long x)

Overrides java.io.PrintWriter.println.

Print a long integer and then terminate the line. This method behaves as though it invokes print(long) and then println().

Parameters
x:long

the long value to be printed

printlnback to summary
public void println(float x)

Overrides java.io.PrintWriter.println.

Print a floating-point number and then terminate the line. This method behaves as though it invokes print(float) and then println().

Parameters
x:float

the float value to be printed

printlnback to summary
public void println(double x)

Overrides java.io.PrintWriter.println.

Print a double-precision floating-point number and then terminate the line. This method behaves as though it invokes print(double) and then println().

Parameters
x:double

the double value to be printed

printlnback to summary
public void println(char[] x)

Overrides java.io.PrintWriter.println.

Print an array of characters and then terminate the line. This method behaves as though it invokes print(char[]) and then println().

Parameters
x:char[]

the array of char values to be printed

printlnback to summary
public void println(String x)

Overrides java.io.PrintWriter.println.

Print a String and then terminate the line. This method behaves as though it invokes print(String) and then println().

Parameters
x:String

the String value to be printed

printlnback to summary
public void println(Object x)

Overrides java.io.PrintWriter.println.

Print an Object and then terminate the line. This method behaves as though it invokes print(Object) and then println().

Parameters
x:Object

the Object value to be printed

writeback to summary
public void write(int c)

Overrides java.io.PrintWriter.write.

Write a single character.

Parameters
c:int

int specifying a character to be written.

writeback to summary
public void write(char[] buf, int off, int len)

Overrides java.io.PrintWriter.write.

Write a portion of an array of characters.

Parameters
buf:char[]

Array of characters

off:int

Offset from which to start writing characters

len:int

Number of characters to write

writeback to summary
public void write(char[] buf)

Overrides java.io.PrintWriter.write.

Write an array of characters. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.

Parameters
buf:char[]

Array of characters to be written

writeback to summary
public void write(String s, int off, int len)

Overrides java.io.PrintWriter.write.

Write a portion of a string.

Parameters
s:String

A String

off:int

Offset from which to start writing characters

len:int

Number of characters to write

writeback to summary
public void write(String s)

Overrides java.io.PrintWriter.write.

Write a string. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.

Parameters
s:String

String to be written