|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
org.exoplatform.commons.utils.Printer
org.exoplatform.commons.utils.OutputStreamPrinter
public class OutputStreamPrinter
An extension of Printer that encodes the text with a provided encoder and sends the resulting
bytes on an OutputStream. The instance can be configured to have different behavior
on failure of the output stream.
The ignoreOnFailure property will stop to make further invocations to the output stream if an exception
is thrown by the output stream except for the close() method.
The failureFlow property modifies the control flow of the method invocation when the output stream throws an
IOException.
IOFailureFlow.IGNORE value ignores the exception.IOFailureFlow.RETHROW value rethrows the exception.IOFailureFlow.THROW_UNDECLARED value throws instead a
UndeclaredIOException exception wrapping the original exception.
| Field Summary |
|---|
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
OutputStreamPrinter(TextEncoder encoder,
OutputStream out)
Builds an instance with the failureFlow being IOFailureFlow.RETHROW and
a the ignoreOnFailure property set to false. |
|
OutputStreamPrinter(TextEncoder encoder,
OutputStream out,
IOFailureFlow failureFlow,
boolean ignoreOnFailure)
Builds a new instance. |
|
| Method Summary | |
|---|---|
void |
close()
|
void |
flush()
|
IOFailureFlow |
getFailureFlow()
Returns the failure flow. |
boolean |
getIgnoreOnFailure()
Returns the ignore on failure property. |
boolean |
isFailed()
|
void |
write(char[] cbuf)
|
void |
write(char[] cbuf,
int off,
int len)
|
void |
write(int c)
|
void |
write(String str)
|
void |
write(String str,
int off,
int len)
|
| Methods inherited from class org.exoplatform.commons.utils.Printer |
|---|
print, println, println |
| Methods inherited from class java.io.Writer |
|---|
append, append, append |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OutputStreamPrinter(TextEncoder encoder,
OutputStream out)
throws IllegalArgumentException
IOFailureFlow.RETHROW and
a the ignoreOnFailure property set to false.
encoder - the encoderout - the output
IllegalArgumentException - if any argument is null
public OutputStreamPrinter(TextEncoder encoder,
OutputStream out,
IOFailureFlow failureFlow,
boolean ignoreOnFailure)
throws IllegalArgumentException
encoder - the encoderout - the outputfailureFlow - the control flow failureFlowignoreOnFailure - the behavior on failure
IllegalArgumentException - if any argument is null| Method Detail |
|---|
public IOFailureFlow getFailureFlow()
public boolean getIgnoreOnFailure()
public boolean isFailed()
public void write(int c)
throws IOException
write in class WriterIOException
public void write(char[] cbuf)
throws IOException
write in class WriterIOException
public void write(String str)
throws IOException
write in class WriterIOException
public void write(String str,
int off,
int len)
throws IOException
write in class WriterIOException
public void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOException
public void flush()
throws IOException
flush in interface Flushableflush in class WriterIOException
public void close()
throws IOException
close in interface Closeableclose in class WriterIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||