|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventstore.fs.FileSystemBufferedReaderDomainEventStream
public class FileSystemBufferedReaderDomainEventStream
DomainEventStream implementation that reads DomainEvents from the filesystem using an InputStream
.
Directly upcasts the events after reading using an UpcasterChain
.
Constructor Summary | |
---|---|
FileSystemBufferedReaderDomainEventStream(InputStream inputStream,
Serializer serializer,
UpcasterChain upcasterChain)
Initialize a BufferedReaderDomainEventStream using the given inputStream and
serializer . |
Method Summary | |
---|---|
void |
close()
|
boolean |
hasNext()
Returns true if the stream has more events, meaning that a call to next() will not
result in an exception. |
DomainEventMessage |
next()
Returns the next events in the stream, if available. |
DomainEventMessage |
peek()
Returns the next events in the stream, if available, without moving the pointer forward. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileSystemBufferedReaderDomainEventStream(InputStream inputStream, Serializer serializer, UpcasterChain upcasterChain)
inputStream
and
serializer
. The inputStream
must provide a serialized DomainEvent, prefixed with a
UTF-8 encoded number indicating the number of bytes to read and a number representing the sequence number of
the event. In between each number and the serialized DomainEvent, there must be at least a single whitespace
character.
Example:1234 The serialized domain event using 1234 bytes...
The reader will be closed when the last event has been read from it, or when an exception occurs while
reading or deserializing an event.
inputStream
- The inputStream providing serialized DomainEventsserializer
- The serializer to deserialize the DomainEventsupcasterChain
- used to upcast events directly after being readMethod Detail |
---|
public boolean hasNext()
DomainEventStream
true
if the stream has more events, meaning that a call to next()
will not
result in an exception. If a call to this method returns false
, there is no guarantee about the
result of a consecutive call to next()
hasNext
in interface DomainEventStream
true
if the stream contains more events.public DomainEventMessage next()
DomainEventStream
hasNext()
to obtain a guarantee about the
availability of any next event. Each call to next()
will forward the pointer to the next event in
the stream.
If the pointer has reached the end of the stream, the behavior of this method is undefined. It could either
return null
, or throw an exception, depending on the actual implementation. Use DomainEventStream.hasNext()
to confirm the existence of elements after the current pointer.
next
in interface DomainEventStream
public DomainEventMessage peek()
DomainEventStream
DomainEventStream.next()
will return the same event as a call to peek()
. Use hasNext()
to obtain a
guarantee about the availability of any next event.
If the pointer has reached the end of the stream, the behavior of this method is undefined. It could either
return null
, or throw an exception, depending on the actual implementation. Use DomainEventStream.hasNext()
to confirm the existence of elements after the current pointer.
peek
in interface DomainEventStream
public void close() throws IOException
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |