@InterfaceAudience.Private @InterfaceStability.Evolving public class BlobDeserializer extends Object implements EventDeserializer
Note that this approach is not suitable for very large objects because it buffers up the entire BLOB.
Modifier and Type | Class and Description |
---|---|
static class |
BlobDeserializer.Builder
Builder implementations MUST have a public no-arg constructor
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_BLOB_LENGTH_DEFAULT |
static String |
MAX_BLOB_LENGTH_KEY |
Modifier | Constructor and Description |
---|---|
protected |
BlobDeserializer(Context context,
ResettableInputStream in) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Calls
EventDeserializer.reset() on the stream and then closes it. |
void |
mark()
Marks the underlying input stream, indicating that the events previously
returned by this EventDeserializer have been successfully committed.
|
Event |
readEvent()
Reads a BLOB from a file and returns an event
|
List<Event> |
readEvents(int numEvents)
Batch BLOB read
|
void |
reset()
Resets the underlying input stream to the last known mark (or beginning
of the stream if
EventDeserializer.mark() was never previously called. |
public static final String MAX_BLOB_LENGTH_KEY
public static final int MAX_BLOB_LENGTH_DEFAULT
protected BlobDeserializer(Context context, ResettableInputStream in)
public Event readEvent() throws IOException
readEvent
in interface EventDeserializer
IOException
EventDeserializer.mark()
,
EventDeserializer.reset()
public List<Event> readEvents(int numEvents) throws IOException
readEvents
in interface EventDeserializer
numEvents
- Maximum number of events to return.IOException
EventDeserializer.mark()
,
EventDeserializer.reset()
public void mark() throws IOException
EventDeserializer
mark
in interface EventDeserializer
mark
in interface Resettable
IOException
EventDeserializer.reset()
public void reset() throws IOException
EventDeserializer
EventDeserializer.mark()
was never previously called. This should
be done in the case of inability to commit previously-deserialized events.reset
in interface EventDeserializer
reset
in interface Resettable
IOException
EventDeserializer.mark()
public void close() throws IOException
EventDeserializer
EventDeserializer.reset()
on the stream and then closes it.
In the case of successful completion of event consumption,
EventDeserializer.mark()
MUST be called before close()
.close
in interface Closeable
close
in interface AutoCloseable
close
in interface EventDeserializer
IOException
EventDeserializer.mark()
,
EventDeserializer.reset()
Copyright © 2009-2016 Apache Software Foundation. All Rights Reserved.