public class AvroItemReader<T> extends AbstractItemCountingItemStreamItemReader<T>
ItemReader
that deserializes data from a Resource
containing serialized Avro objects.Constructor and Description |
---|
AvroItemReader(org.springframework.core.io.Resource resource,
java.lang.Class<T> clazz) |
AvroItemReader(org.springframework.core.io.Resource data,
org.springframework.core.io.Resource schema) |
Modifier and Type | Method and Description |
---|---|
protected void |
doClose()
Close the resources opened in
AbstractItemCountingItemStreamItemReader.doOpen() . |
protected void |
doOpen()
Open resources necessary to start reading input.
|
protected T |
doRead()
Read next item from input.
|
void |
setEmbeddedSchema(boolean embeddedSchema)
Disable or enable reading an embedded Avro schema.
|
close, getCurrentItemCount, isSaveState, jumpToItem, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
getExecutionContextKey, getName, setExecutionContextName, setName
public AvroItemReader(org.springframework.core.io.Resource resource, java.lang.Class<T> clazz)
resource
- the Resource
containing objects serialized with Avro.clazz
- the data type to be deserialized.public AvroItemReader(org.springframework.core.io.Resource data, org.springframework.core.io.Resource schema)
data
- the Resource
containing the data to be read.schema
- the Resource
containing the Avro schema.public void setEmbeddedSchema(boolean embeddedSchema)
embeddedSchema
- set to false to if the input does not embed an Avro schema.@Nullable protected T doRead() throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
doRead
in class AbstractItemCountingItemStreamItemReader<T>
null
if the data source is exhaustedjava.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the frameworkprotected void doOpen() throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
doOpen
in class AbstractItemCountingItemStreamItemReader<T>
java.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the frameworkprotected void doClose() throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
AbstractItemCountingItemStreamItemReader.doOpen()
.doClose
in class AbstractItemCountingItemStreamItemReader<T>
java.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the framework