public class FileEventStream extends Object implements ObjectStream<Event>
Constructor and Description |
---|
FileEventStream(File file)
Creates a new file event stream from the specified file.
|
FileEventStream(String fileName) |
FileEventStream(String fileName,
String encoding)
Creates a new file event stream from the specified file name.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the
ObjectStream and releases all allocated
resources. |
Event |
read()
Returns the next object.
|
void |
reset()
Repositions the stream at the beginning and the previously seen object sequence
will be repeated exactly.
|
static String |
toLine(Event event)
Generates a string representing the specified event.
|
public FileEventStream(String fileName, String encoding) throws IOException
fileName
- the name fo the file containing the events.IOException
- When the specified file can not be read.public FileEventStream(String fileName) throws IOException
IOException
public FileEventStream(File file) throws IOException
file
- the file containing the events.IOException
- When the specified file can not be read.public Event read() throws IOException
ObjectStream
read
in interface ObjectStream<Event>
IOException
- if there is an error during readingpublic void close() throws IOException
ObjectStream
ObjectStream
and releases all allocated
resources. After close was called its not allowed to call
read or reset.close
in interface AutoCloseable
close
in interface ObjectStream<Event>
IOException
- if there is an error during closing the streampublic static String toLine(Event event)
event
- The event for which a string representation is needed.public void reset() throws IOException, UnsupportedOperationException
ObjectStream
reset
in interface ObjectStream<Event>
IOException
- if there is an error during reseting the streamUnsupportedOperationException
Copyright © 2015 The Apache Software Foundation. All rights reserved.