org.eclipse.smila.taskworker.output
Class RecordOutput
java.lang.Object
org.eclipse.smila.taskworker.io.IODataObject
org.eclipse.smila.taskworker.output.Output
org.eclipse.smila.taskworker.output.RecordOutput
public class RecordOutput
- extends Output
Provides simplified access for creating Record bulks by writing one Record (or Any) at a
time. You can also directly access the underlying IpcStreamWriter BON writer, but you should not mix up
direct access to the BON writer with the writeRecord(Record) and writeAny(Any) methods.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RecordOutput
public RecordOutput(BulkInfo dataObject,
ObjectStoreService objectStore)
- Parameters:
dataObject - The data objectobjectStore - The reference to the object store service
writeRecord
public void writeRecord(Record record)
throws ObjectStoreException,
java.io.IOException
- Parameters:
record - The record to write
- Throws:
ObjectStoreException
java.io.IOException
writeAny
public void writeAny(Any any)
throws ObjectStoreException,
java.io.IOException
- Parameters:
any - The object to write
- Throws:
ObjectStoreException
java.io.IOException
commit
public void commit()
throws ObjectStoreException,
java.io.IOException
- Commit the data object to objectstore. Called by the WorkerManager after the task was finished.
- Specified by:
commit in class Output
- Throws:
ObjectStoreException
java.io.IOException
abort
public void abort()
throws java.io.IOException
- method for aborting the stream when not committing it.
- Specified by:
abort in class Output
- Throws:
java.io.IOException
getStreamWriter
public IpcStreamWriter getStreamWriter()
throws ObjectStoreException,
java.io.IOException
- Returns:
- the stream writer
- Throws:
ObjectStoreException
java.io.IOException
getRecordCount
public long getRecordCount()
- Returns:
- number of records written so far using
#writeRecord()
getBytesWritten
public long getBytesWritten()
- See Also:
StreamOutput.getBytesWritten()
getCounter
public java.util.Map<java.lang.String,java.lang.Number> getCounter()
- Description copied from class:
IODataObject
- create basic counter map.
- Overrides:
getCounter in class IODataObject
- Returns:
- counter map of superclass extended by the number of records written to the stream.