org.openjena.riot
Class RiotParsePuller<T>

java.lang.Object
  extended by org.openjena.riot.RiotParsePuller<T>
All Implemented Interfaces:
Iterator<T>, Closeable, LangRIOT
Direct Known Subclasses:
RiotQuadParsePuller, RiotTripleParsePuller

public abstract class RiotParsePuller<T>
extends Object
implements Iterator<T>, Closeable, LangRIOT

A wrapper that converts the RIOT parsing API from push to pull. It does this by starting up a thread that feeds results through a BlockingQueue. You must call parse() in order to start the background thread parsing the InputStream. You then use the iterator methods to retrieve the statements.

Note: You can avoid using this class if you are dealing with N-Triples or N-Quads, because RIOT provides pull interfaces directly for those parsers.


Constructor Summary
RiotParsePuller(InputStream in, Lang lang, String baseIRI)
           
 
Method Summary
 void close()
           
 Lang getLang()
           
 ParserProfile getProfile()
           
 boolean hasNext()
           
 T next()
           
 void parse()
          Starts the background thread parsing the InputStream.
 void remove()
           
 void setProfile(ParserProfile profile)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RiotParsePuller

public RiotParsePuller(InputStream in,
                       Lang lang,
                       String baseIRI)
Method Detail

getLang

public Lang getLang()
Specified by:
getLang in interface LangRIOT

getProfile

public ParserProfile getProfile()
Specified by:
getProfile in interface LangRIOT

setProfile

public void setProfile(ParserProfile profile)
Specified by:
setProfile in interface LangRIOT

parse

public void parse()
Starts the background thread parsing the InputStream. This method returns immediately. To retrieve the results, use the iterator methods.

Specified by:
parse in interface LangRIOT

close

public void close()
Specified by:
close in interface Closeable

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

next

public T next()
Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>


Licenced under the Apache License, Version 2.0