|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.api.io.ReaderProvider
com.univocity.api.io.InputQueue<T>
public abstract class InputQueue<T>
A queue of a sequence of inputs to be processed. Inputs can come in all sort of formats, but must be abstracted
by a Reader. Variables can be used to assign values to each input and provide more control and
information about what the input represents (e.g. date the input was produced, some user ID associated with the
input, etc)
InputFileQueue,
InputReaderQueue| Constructor Summary | |
|---|---|
InputQueue()
Creates an empty queue. |
|
| Method Summary | ||
|---|---|---|
void |
assignVariablesToLastEntry(Map<String,Object> variables)
Assigns a set of variables and their values to the last entry added to this input queue |
|
void |
assignVariableToLastEntry(String variable,
Object value)
Assigns a variable and its value to the last entry added to this input queue |
|
Map<String,Object> |
getCurrentVariables()
Returns a map of all variables assigned to the input being read |
|
Reader |
getResource()
Grabs the next input of the queue, opens it as an instanceof Reader with the help of method
open(Object), loads the variables associated with the input, and returns the Reader. |
|
boolean |
isEmpty()
Queries whether the input is empty (i.e. |
|
protected void |
offer(T input)
Adds an input to be processed to the end of the queue |
|
protected abstract Reader |
open(T input)
Opens an input and returns an instanceof Reader which will be used to consume it. |
|
T |
peek()
Returns the current input at the head of the queue. |
|
Object |
readVariable(String variable)
Returns the value assigned to a given variable associated with the current input being read. |
|
|
readVariable(String variable,
Class<O> type)
Returns the value assigned to a given variable associated with the current input being read. |
|
|
readVariable(String variable,
O defaultValue)
Returns the value assigned to a given variable associated with the current input being read. |
|
int |
size()
Returns the number of inputs to be processed that are waiting in the queue |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InputQueue()
| Method Detail |
|---|
public final boolean isEmpty()
true if there are no more inputs to be processed, otherwise falsepublic final int size()
public final T peek()
protected final void offer(T input)
input - the input to be processed
public void assignVariableToLastEntry(String variable,
Object value)
variable - the variable name associated to the last input to be processed in this input queuevalue - the value to associated to the given variablepublic void assignVariablesToLastEntry(Map<String,Object> variables)
variables - the variable and values associated to the last input to be processed in this input queuepublic final Reader getResource()
Reader with the help of method
open(Object), loads the variables associated with the input, and returns the Reader.
Reader to consume the next element of the input queue.public Object readVariable(String variable)
variable - the variable name
null if it doesn't exist
public <O> O readVariable(String variable,
O defaultValue)
O - the type of value returned by this method.variable - the variable namedefaultValue - a default value to return in case the variable doesn't exist or its value is null
null
public <O> O readVariable(String variable,
Class<O> type)
O - the type of value returned by this method.variable - the variable nametype - the type of value expected to be returned. The value assigned to this
variable will be cast to the given type.
nullpublic Map<String,Object> getCurrentVariables()
protected abstract Reader open(T input)
Reader which will be used to consume it.
Used when getResource() is called.
input - the input to be read
Reader that can be used to consume the given input.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||