Package org.jgrapes.io.events
Class Output<T extends Buffer>
- All Implemented Interfaces:
Future<Void>
,Associator
,Eligible
This event signals that a new chunk of internally generated data is to be
forwarded to some destination.
This type of event is commonly used for data flowing out of the application.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
Fields inherited from class org.jgrapes.core.internal.EventBase
completed, completionEvents, invokedFor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Output
<ByteBuffer> from
(byte[] data, boolean endOfRecord) Convenience method that creates a Outputevent from a byte[]
.static Output
<CharBuffer> Convenience method that creates a Outputevent from a String
.fromSink
(ManagedBuffer<B> buffer, boolean endOfRecord) Create a new event with the given buffer.fromSource
(ManagedBuffer<B> buffer, boolean endOfRecord) Create a new event with the given buffer.Methods inherited from class org.jgrapes.io.events.IOEvent
buffer, data, handled, hasRemaining, isEndOfRecord, remaining, toString
Methods inherited from class org.jgrapes.core.Event
addCompletionEvent, associated, cancel, channels, channels, completionEvents, currentResults, defaultCriterion, forChannels, get, get, handlingError, isCancelled, isDone, isEligibleFor, isStopped, processedBy, results, results, resumeHandling, setAssociated, setChannels, setRequiresResult, setResult, stop, suspendHandling, suspendHandling, tieTo
Methods inherited from class org.jgrapes.core.internal.EventBase
disableTracking, enqueued, firstResultAssigned, isTracked, onCompletion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGet
Methods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
Output
Create a new event from an existing event.This constructor is useful if the data is to be forwarded to another channel by a new event.
The buffer is reused in the new event (the lock count is incremented).
- Parameters:
event
- the existing event
-
-
Method Details
-
fromSource
Create a new event with the given buffer.The buffer must have been prepared for invoking
get
-methods.- Parameters:
buffer
- the buffer with the dataendOfRecord
- if the event ends a data record
-
fromSink
Create a new event with the given buffer.Creating the event flips the buffer, which is assumed to have been used for collecting data up to now.
- Parameters:
buffer
- the buffer with the dataendOfRecord
- if the event ends a data record
-
from
Convenience method that creates a Outputevent from a String
.- Parameters:
data
- the string to wrapendOfRecord
- if the event ends a data record- Returns:
- the event
-
from
Convenience method that creates a Outputevent from a byte[]
.- Parameters:
data
- the array to wrapendOfRecord
- if the event ends a data record- Returns:
- the event
-