Class JsonIterator<T>
java.lang.Object
org.apache.druid.data.input.impl.prefetch.JsonIterator<T>
- Type Parameters:
T- the type of object returned by this iterator
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<T>,CloseableIterator<T>
An iterator over an array of JSON objects. Uses
ObjectCodec to deserialize regular Java objects.-
Constructor Summary
ConstructorsConstructorDescriptionJsonIterator(com.fasterxml.jackson.core.type.TypeReference<T> typeRef, InputStream inputStream, Closeable resourceCloser, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.java.util.common.parsers.CloseableIterator
flatMap, mapMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
JsonIterator
public JsonIterator(com.fasterxml.jackson.core.type.TypeReference<T> typeRef, InputStream inputStream, Closeable resourceCloser, com.fasterxml.jackson.databind.ObjectMapper objectMapper) - Parameters:
typeRef- the object type that the JSON object should be deserialized intoinputStream- stream containing an array of JSON objectsresourceCloser- aCloseableimplementation to release resources that the object is holdingobjectMapper- object mapper, used for deserialization
-
-
Method Details
-
hasNext
public boolean hasNext()Returnstrueif there are more objects to be read. -
next
Retrieves the next deserialized object from the stream of JSON objects. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-