public class NGInputStream
extends java.io.FilterInputStream
implements java.io.Closeable
| Constructor and Description |
|---|
NGInputStream(java.io.InputStream in,
java.io.DataOutputStream out,
java.io.PrintStream serverLog,
int heartbeatTimeoutMillis)
Creates a new NGInputStream wrapping the specified InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClientListener(NGClientListener listener)
Registers a new NGClientListener to be called on client disconnection or calls the listeners
clientDisconnected method if the client has already disconnected to avoid races.
|
void |
addHeartbeatListener(NGHeartbeatListener listener) |
int |
available() |
void |
close()
Cancels the thread reading from the NailGun client.
|
boolean |
isClientConnected() |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int offset,
int length) |
void |
removeClientListener(NGClientListener listener) |
void |
removeHeartbeatListener(NGHeartbeatListener listener) |
public NGInputStream(java.io.InputStream in,
java.io.DataOutputStream out,
java.io.PrintStream serverLog,
int heartbeatTimeoutMillis)
in - the InputStream to wrapout - the OutputStream to which SENDINPUT chunks should be sentserverLog - the PrintStream to which server logging messages should be writtenheartbeatTimeoutMillis - the interval between heartbeats before considering the client
disconnectedpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreampublic int available()
throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOExceptionInputStream.available()public boolean markSupported()
markSupported in class java.io.FilterInputStreamInputStream.markSupported()public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionInputStream.read()public int read(byte[] b)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionInputStream.read(byte[])public int read(byte[] b,
int offset,
int length)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionInputStream.read(byte[], int, int)public boolean isClientConnected()
public void addClientListener(NGClientListener listener)
listener - the NGClientListener to be notified of client events.java.lang.InterruptedException - if thrown by the clientDisconnected method or it calls System.exit().public void removeClientListener(NGClientListener listener)
listener - the NGClientListener to no longer be notified of client events.public void addHeartbeatListener(NGHeartbeatListener listener)
listener - the NGHeartbeatListener to be notified of client events.public void removeHeartbeatListener(NGHeartbeatListener listener)
listener - the NGClientListener to no longer be notified of client events.