public abstract class DataWriter<C extends ApplicationContext> extends AbstractAsyncExecutable<C> implements java.io.Closeable
AsyncTask.
It provides a safe execution frame which opens and closes the out-stream on each executeAsync()
and implements the methods of PrintWriter for convenience.childTaskRef, isTestMode, monitorController, resultRef, stateFlag| Constructor and Description |
|---|
DataWriter(C ctx,
java.io.File outFile) |
DataWriter(C ctx,
LogChannel logCh,
java.io.File outFile) |
DataWriter(C ctx,
LogChannel logCh,
java.io.File outFile,
java.lang.String taskName) |
DataWriter(C ctx,
LogChannel logCh,
java.io.OutputStream outStream) |
DataWriter(C ctx,
LogChannel logCh,
java.io.OutputStream outStream,
java.lang.String taskName) |
DataWriter(C ctx,
java.io.OutputStream outStream) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected java.io.FileOutputStream |
createFileOutputStream(java.io.File outputFile) |
void |
executeAsync()
Contains the code to be executed asynchronously.
|
void |
flush() |
java.io.PrintWriter |
format(java.util.Locale l,
java.lang.String format,
java.lang.Object... args) |
java.io.PrintWriter |
format(java.lang.String format,
java.lang.Object... args) |
java.lang.String |
getEncoding() |
java.io.File |
getOutputFile() |
long |
getWriteDuration() |
java.io.PrintWriter |
getWriter() |
protected java.io.PrintWriter |
openStream() |
protected abstract void |
performWrite()
Needs to be overridden to actually write data.
|
void |
print(boolean b) |
void |
print(char c) |
void |
print(char[] s) |
void |
print(double d) |
void |
print(float f) |
void |
print(int i) |
void |
print(long l) |
void |
print(java.lang.Object obj) |
void |
print(java.lang.String s) |
java.io.PrintWriter |
printf(java.util.Locale l,
java.lang.String format,
java.lang.Object... args) |
java.io.PrintWriter |
printf(java.lang.String format,
java.lang.Object... args) |
void |
printLine(java.lang.String format,
java.lang.Object... args)
print formatted data to writer by using Locale.US and appending a system dependant NewLine
|
void |
println() |
void |
println(boolean x) |
void |
println(char x) |
void |
println(char[] x) |
void |
println(double x) |
void |
println(float x) |
void |
println(int x) |
void |
println(long x) |
void |
println(java.lang.Object x) |
void |
println(java.lang.String x) |
void |
setCloseStreamWhenFinished(boolean needsToClose) |
void |
setEncoding(java.lang.String encoding)
Sets the encoding used by the underlying writer.
|
void |
setOutputFile(java.io.File outputFile) |
void |
setOutputStream(java.io.OutputStream outputStream)
Allows for setting a new outputStream for writing data to.
|
void |
write(char c) |
void |
write(char[] buf) |
void |
write(char[] buf,
int off,
int len) |
void |
write(java.lang.String str) |
void |
write(java.lang.String str,
int off,
int len) |
addMonitor, checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, handleFinish, handleStart, handleSuccess, hasError, hasMonitor, isCancellable, notifyProceeded, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelledgetApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetApplicationContextgetLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelpublic DataWriter(C ctx, java.io.File outFile)
public DataWriter(C ctx, LogChannel logCh, java.io.File outFile)
public DataWriter(C ctx, LogChannel logCh, java.io.File outFile, java.lang.String taskName)
public DataWriter(C ctx, java.io.OutputStream outStream)
public DataWriter(C ctx, LogChannel logCh, java.io.OutputStream outStream)
public DataWriter(C ctx, LogChannel logCh, java.io.OutputStream outStream, java.lang.String taskName)
public final void executeAsync()
throws java.lang.Exception
AsyncExecutableRunnable.run() for async execution.executeAsync in interface AsyncExecutable<C extends ApplicationContext>executeAsync in class AbstractAsyncExecutable<C extends ApplicationContext>java.lang.Exceptionfor synchronous executionpublic final long getWriteDuration()
public void setCloseStreamWhenFinished(boolean needsToClose)
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionprotected java.io.PrintWriter openStream()
throws java.io.IOException
java.io.IOExceptionprotected java.io.FileOutputStream createFileOutputStream(java.io.File outputFile)
throws java.io.IOException
java.io.IOExceptionpublic void setOutputStream(java.io.OutputStream outputStream)
public void setEncoding(java.lang.String encoding)
public java.lang.String getEncoding()
protected abstract void performWrite()
throws java.lang.Exception
java.lang.Exceptionpublic void printLine(java.lang.String format,
java.lang.Object... args)
public java.io.File getOutputFile()
public void setOutputFile(java.io.File outputFile)
public java.io.PrintWriter getWriter()
public void write(char c)
public void write(char[] buf)
public void write(char[] buf,
int off,
int len)
public void write(java.lang.String str,
int off,
int len)
public void write(java.lang.String str)
public java.io.PrintWriter format(java.util.Locale l,
java.lang.String format,
java.lang.Object... args)
public java.io.PrintWriter format(java.lang.String format,
java.lang.Object... args)
public void print(boolean b)
public void print(char c)
public void print(char[] s)
public void print(double d)
public void print(float f)
public void print(int i)
public void print(long l)
public void print(java.lang.Object obj)
public void print(java.lang.String s)
public java.io.PrintWriter printf(java.util.Locale l,
java.lang.String format,
java.lang.Object... args)
public java.io.PrintWriter printf(java.lang.String format,
java.lang.Object... args)
public void println()
public void println(boolean x)
public void println(char x)
public void println(char[] x)
public void println(double x)
public void println(float x)
public void println(int x)
public void println(long x)
public void println(java.lang.Object x)
public void println(java.lang.String x)
public void flush()
Copyright © 2014 EsprIT-Systems. All Rights Reserved.