org.mortbay.io.nio
public class ChannelEndPoint extends Object implements EndPoint
Modifier and Type | Field and Description |
---|---|
protected ByteChannel |
_channel |
protected ByteBuffer[] |
_gather2 |
protected InetSocketAddress |
_local |
protected InetSocketAddress |
_remote |
protected Socket |
_socket |
Constructor and Description |
---|
ChannelEndPoint(ByteChannel channel) |
Modifier and Type | Method and Description |
---|---|
boolean |
blockReadable(long millisecs) |
boolean |
blockWritable(long millisecs) |
void |
close()
Close any backing stream associated with the buffer
|
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.
|
ByteChannel |
getChannel() |
String |
getLocalAddr() |
String |
getLocalHost() |
int |
getLocalPort() |
String |
getRemoteAddr() |
String |
getRemoteHost() |
int |
getRemotePort() |
Object |
getTransport() |
boolean |
isBlocking() |
boolean |
isBufferingInput() |
boolean |
isBufferingOutput() |
boolean |
isBufferred() |
boolean |
isOpen() |
void |
shutdownOutput()
Shutdown any backing output stream associated with the endpoint
|
protected final ByteChannel _channel
protected final ByteBuffer[] _gather2
protected final Socket _socket
protected final InetSocketAddress _local
protected final InetSocketAddress _remote
public ChannelEndPoint(ByteChannel channel)
public boolean isBlocking()
isBlocking
in interface EndPoint
public boolean blockReadable(long millisecs) throws IOException
blockReadable
in interface EndPoint
IOException
public boolean blockWritable(long millisecs) throws IOException
blockWritable
in interface EndPoint
IOException
public void shutdownOutput() throws IOException
EndPoint
shutdownOutput
in interface EndPoint
IOException
public void close() throws IOException
EndPoint
close
in interface EndPoint
IOException
public int fill(Buffer buffer) throws IOException
EndPoint
fill
in interface EndPoint
int
value indicating the number of bytes
filled or -1 if EOF is reached.IOException
public int flush(Buffer buffer) throws IOException
EndPoint
flush
in interface EndPoint
buffer
- The buffer to flush. This buffers getIndex is updated.IOException
public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
EndPoint
flush
in interface EndPoint
header
- 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.IOException
public ByteChannel getChannel()
public String getLocalAddr()
getLocalAddr
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public String getLocalHost()
getLocalHost
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public int getLocalPort()
getLocalPort
in interface EndPoint
EndPoint
is listening, or 0
if this EndPoint
does not represent a network connection.public String getRemoteAddr()
getRemoteAddr
in interface EndPoint
EndPoint
is connected, or null
if this EndPoint
does not represent a network connection.public String getRemoteHost()
getRemoteHost
in interface EndPoint
EndPoint
is connected, or null
if this EndPoint
does not represent a network connection.public int getRemotePort()
getRemotePort
in interface EndPoint
EndPoint
is connected, or 0
if this EndPoint
does not represent a network connection.public Object getTransport()
getTransport
in interface EndPoint
public void flush() throws IOException
EndPoint
flush
in interface EndPoint
IOException
public boolean isBufferingInput()
isBufferingInput
in interface EndPoint
public boolean isBufferingOutput()
isBufferingOutput
in interface EndPoint
public boolean isBufferred()
isBufferred
in interface EndPoint
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.