public class StreamEndPoint extends Object implements EndPoint
| Constructor and Description |
|---|
StreamEndPoint(InputStream in,
OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
blockReadable(long millisecs) |
boolean |
blockWritable(long millisecs) |
void |
close()
Close any backing stream associated with the endpoint
|
int |
fill(Buffer buffer)
Fill the buffer from the current putIndex to it's capacity from whatever
byte source is backing the buffer.
|
void |
flush()
Flush any buffered output.
|
int |
flush(Buffer buffer)
Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer.
|
int |
flush(Buffer header,
Buffer buffer,
Buffer trailer)
Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer.
|
InputStream |
getInputStream() |
String |
getLocalAddr() |
String |
getLocalHost() |
int |
getLocalPort() |
int |
getMaxIdleTime()
Get the max idle time in ms.
|
OutputStream |
getOutputStream() |
String |
getRemoteAddr() |
String |
getRemoteHost() |
int |
getRemotePort() |
Object |
getTransport() |
protected void |
idleExpired() |
boolean |
isBlocking() |
boolean |
isClosed() |
boolean |
isInputShutdown() |
boolean |
isOpen() |
boolean |
isOutputShutdown() |
void |
setInputStream(InputStream in) |
void |
setMaxIdleTime(int timeMs)
Set the max idle time.
|
void |
setOutputStream(OutputStream out) |
void |
shutdownInput()
Shutdown any backing input stream associated with the endpoint
|
void |
shutdownOutput()
Shutdown any backing output stream associated with the endpoint
|
public StreamEndPoint(InputStream in, OutputStream out)
public boolean isBlocking()
isBlocking in interface EndPointpublic boolean blockReadable(long millisecs)
throws IOException
blockReadable in interface EndPointIOExceptionpublic boolean blockWritable(long millisecs)
throws IOException
blockWritable in interface EndPointIOExceptionpublic final boolean isClosed()
public void shutdownOutput()
throws IOException
EndPointshutdownOutput in interface EndPointIOExceptionpublic boolean isInputShutdown()
isInputShutdown in interface EndPointpublic void shutdownInput()
throws IOException
EndPointshutdownInput in interface EndPointIOExceptionpublic boolean isOutputShutdown()
isOutputShutdown in interface EndPointpublic void close()
throws IOException
EndPointclose in interface EndPointIOExceptionprotected void idleExpired()
throws IOException
IOExceptionpublic int fill(Buffer buffer) throws IOException
EndPointfill in interface EndPointint value indicating the number of bytes
filled or -1 if EOF is reached.EofException - If input is shutdown or the endpoint is closed.IOExceptionpublic int flush(Buffer buffer) throws IOException
EndPointflush in interface EndPointbuffer - The buffer to flush. This buffers getIndex is updated.EofException - If the endpoint is closed or output is shutdown.IOExceptionpublic int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
EndPointflush in interface EndPointheader - A buffer to write before flushing this buffer. This buffers getIndex is updated.buffer - The buffer to flush. This buffers getIndex is updated.trailer - A buffer to write after flushing this buffer. This buffers getIndex is updated.IOExceptionpublic String getLocalAddr()
getLocalAddr in interface EndPointEndPoint is bound, or null
if this EndPoint does not represent a network connection.public String getLocalHost()
getLocalHost in interface EndPointEndPoint is bound, or null
if this EndPoint does not represent a network connection.public int getLocalPort()
getLocalPort in interface EndPointEndPoint is listening, or 0
if this EndPoint does not represent a network connection.public String getRemoteAddr()
getRemoteAddr in interface EndPointEndPoint is connected, or null
if this EndPoint does not represent a network connection.public String getRemoteHost()
getRemoteHost in interface EndPointEndPoint is connected, or null
if this EndPoint does not represent a network connection.public int getRemotePort()
getRemotePort in interface EndPointEndPoint is connected, or 0
if this EndPoint does not represent a network connection.public Object getTransport()
getTransport in interface EndPointpublic InputStream getInputStream()
public void setInputStream(InputStream in)
public OutputStream getOutputStream()
public void setOutputStream(OutputStream out)
public void flush()
throws IOException
EndPointflush in interface EndPointEofException - If the endpoint is closed or output is shutdown.IOExceptionpublic int getMaxIdleTime()
EndPointThe max idle time is the time the endpoint can be idle before
extraordinary handling takes place. This loosely corresponds to
the Socket.getSoTimeout() for blocking connections,
but AsyncEndPoint implementations must use other mechanisms
to implement the max idle time.
getMaxIdleTime in interface EndPointpublic void setMaxIdleTime(int timeMs)
throws IOException
EndPointsetMaxIdleTime in interface EndPointtimeMs - the max idle time in MS. Timeout <= 0 implies an infinite timeoutIOException - if the timeout cannot be set.Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.