public abstract class InputHandler extends Object
InputHandler
is responsible for handling the input to the
Pig-Streaming external command.
The managed executable could be fed input in a InputHandler.InputType.SYNCHRONOUS
manner via its stdin
or in an InputHandler.InputType.ASYNCHRONOUS
manner via an external file which is subsequently read by the executable.Modifier and Type | Class and Description |
---|---|
static class |
InputHandler.InputType |
Modifier and Type | Field and Description |
---|---|
protected boolean |
alreadyClosed |
protected PigToStream |
serializer |
Constructor and Description |
---|
InputHandler() |
Modifier and Type | Method and Description |
---|---|
void |
bindTo(OutputStream os)
Bind the
InputHandler to the OutputStream
from which it reads input and sends it to the managed process. |
void |
close(Process process)
Close the
InputHandler since there is no more input
to be sent to the managed process. |
abstract InputHandler.InputType |
getInputType()
Get the handled
InputType |
void |
putNext(Tuple t)
Send the given input
Tuple to the managed executable. |
protected PigToStream serializer
protected boolean alreadyClosed
public abstract InputHandler.InputType getInputType()
InputType
InputType
public void putNext(Tuple t) throws IOException
Tuple
to the managed executable.t
- input Tuple
IOException
public void close(Process process) throws IOException
InputHandler
since there is no more input
to be sent to the managed process.process
- the managed process - this could be null in some cases
like when input is through files. In that case, the process would not
have been exec'ed yet - if this method if overridden it is the responsibility
of the implementer to check that the process is usable. The managed process
object is supplied by the ExecutableManager to this call so that this method
can check if the process is alive if it needs to know.IOException
public void bindTo(OutputStream os) throws IOException
InputHandler
to the OutputStream
from which it reads input and sends it to the managed process.os
- OutputStream
from which to read input data for the
managed processIOException
Copyright © 2007-2017 The Apache Software Foundation