|
||||||||||
| 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,
java.io.OutputStream out)
Builds an instance with the failureFlow being IOFailureFlow.RETHROW and
a the ignoreOnFailure property set to false. |
|
OutputStreamPrinter(TextEncoder encoder,
java.io.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(java.lang.String str)
|
void |
write(java.lang.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,
java.io.OutputStream out)
throws java.lang.IllegalArgumentException
IOFailureFlow.RETHROW and
a the ignoreOnFailure property set to false.
encoder - the encoderout - the output
java.lang.IllegalArgumentException - if any argument is null
public OutputStreamPrinter(TextEncoder encoder,
java.io.OutputStream out,
IOFailureFlow failureFlow,
boolean ignoreOnFailure)
throws java.lang.IllegalArgumentException
encoder - the encoderout - the outputfailureFlow - the control flow failureFlowignoreOnFailure - the behavior on failure
java.lang.IllegalArgumentException - if any argument is null| Method Detail |
|---|
public IOFailureFlow getFailureFlow()
public boolean getIgnoreOnFailure()
public boolean isFailed()
public void write(int c)
throws java.io.IOException
write in class java.io.Writerjava.io.IOException
public void write(char[] cbuf)
throws java.io.IOException
write in class java.io.Writerjava.io.IOException
public void write(java.lang.String str)
throws java.io.IOException
write in class java.io.Writerjava.io.IOException
public void write(java.lang.String str,
int off,
int len)
throws java.io.IOException
write in class java.io.Writerjava.io.IOException
public void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
write in class java.io.Writerjava.io.IOException
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.Writerjava.io.IOException
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.Writerjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||