Top Fields Constructors Methods
org.mortbay.io.nio

public Class ChannelEndPoint

extends Object
implements EndPoint
Class Inheritance
All Implemented Interfaces
org.mortbay.io.EndPoint
Known Direct Subclasses
org.mortbay.io.nio.SelectChannelEndPoint, org.mortbay.jetty.nio.BlockingChannelConnector.Connection
Imports
java.io.IOException, java.net.InetSocketAddress, .Socket, java.nio.ByteBuffer, java.nio.channels.ByteChannel, .GatheringByteChannel, .SelectableChannel, .SocketChannel, org.mortbay.io.Buffer, .EndPoint, org.mortbay.log.Log, org.mortbay.util.StringUtil

Author
gregw To change the template for this generated type comment go to Window - Preferences - Java - Code Generation - Code and Comments

Field Summary

Modifier and TypeField and Description
protected ByteChannel
protected ByteBuffer[]
protected InetSocketAddress
protected InetSocketAddress
protected Socket

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public void
close()

Implements org.mortbay.io.EndPoint.close.

Close any backing stream associated with the buffer
public int
fill(Buffer buffer)

Implements org.mortbay.io.EndPoint.fill.

Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer.
public int
flush(Buffer
The buffer to flush. This buffers getIndex is updated.
buffer
)

Implements org.mortbay.io.EndPoint.flush.

Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer.
public int
flush(Buffer
A buffer to write before flushing this buffer. This buffers getIndex is updated.
header
,
Buffer
The buffer to flush. This buffers getIndex is updated.
buffer
,
Buffer
A buffer to write after flushing this buffer. This buffers getIndex is updated.
trailer
)

Implements org.mortbay.io.EndPoint.flush.

Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer.
public void
flush()

Implements org.mortbay.io.EndPoint.flush.

Flush any buffered output.
public ByteChannel

Returns:

Returns the channel.
getChannel
()

public String
public String
public int
public String
public String
public int
public Object
public boolean
public boolean
public boolean
public boolean
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_channelback to summary
protected ByteChannel _channel
_gather2back to summary
protected ByteBuffer[] _gather2
_localback to summary
protected InetSocketAddress _local
_remoteback to summary
protected InetSocketAddress _remote
_socketback to summary
protected Socket _socket

Constructor Detail

ChannelEndPointback to summary
public ChannelEndPoint(ByteChannel channel)

Method Detail

blockReadableback to summary
public boolean blockReadable(long millisecs) throws IOException

Implements org.mortbay.io.EndPoint.blockReadable.

blockWritableback to summary
public boolean blockWritable(long millisecs) throws IOException

Implements org.mortbay.io.EndPoint.blockWritable.

closeback to summary
public void close() throws IOException

Implements org.mortbay.io.EndPoint.close.

Doc from org.mortbay.io.EndPoint.close.

Close any backing stream associated with the buffer

fillback to summary
public int fill(Buffer buffer) throws IOException

Implements org.mortbay.io.EndPoint.fill.

Doc from org.mortbay.io.EndPoint.fill.

Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer. The putIndex is increased if bytes filled. The buffer may chose to do a compact before filling.

Returns:int

an int value indicating the number of bytes filled or -1 if EOF is reached.

flushback to summary
public int flush(Buffer buffer) throws IOException

Implements org.mortbay.io.EndPoint.flush.

Doc from org.mortbay.io.EndPoint.flush.

Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer. The getIndex is updated with the number of bytes flushed. Any mark set is cleared. If the entire contents of the buffer are flushed, then an implicit empty() is done.

Parameters
buffer:Buffer

The buffer to flush. This buffers getIndex is updated.

Returns:int

the number of bytes written

flushback to summary
public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException

Implements org.mortbay.io.EndPoint.flush.

Doc from org.mortbay.io.EndPoint.flush.

Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer. The getIndex is updated with the number of bytes flushed. Any mark set is cleared. If the entire contents of the buffer are flushed, then an implicit empty() is done. The passed header/trailer buffers are written before/after the contents of this buffer. This may be done either as gather writes, as a poke into this buffer or as several writes. The implementation is free to select the optimal mechanism.

Parameters
header:Buffer

A buffer to write before flushing this buffer. This buffers getIndex is updated.

buffer:Buffer

The buffer to flush. This buffers getIndex is updated.

trailer:Buffer

A buffer to write after flushing this buffer. This buffers getIndex is updated.

Returns:int

the total number of bytes written.

flushback to summary
public void flush() throws IOException

Implements org.mortbay.io.EndPoint.flush.

Doc from org.mortbay.io.EndPoint.flush.

Flush any buffered output. May fail to write all data if endpoint is non-blocking

getChannelback to summary
public ByteChannel getChannel()
Returns:ByteChannel

Returns the channel.

getLocalAddrback to summary
public String getLocalAddr()

Implements org.mortbay.io.EndPoint.getLocalAddr.

Returns:String

Doc from org.mortbay.io.EndPoint.getLocalAddr.

The local IP address to which this EndPoint is bound, or null if this EndPoint does not represent a network connection.

getLocalHostback to summary
public String getLocalHost()

Implements org.mortbay.io.EndPoint.getLocalHost.

Returns:String

Doc from org.mortbay.io.EndPoint.getLocalHost.

The local host name to which this EndPoint is bound, or null if this EndPoint does not represent a network connection.

getLocalPortback to summary
public int getLocalPort()

Implements org.mortbay.io.EndPoint.getLocalPort.

Returns:int

Doc from org.mortbay.io.EndPoint.getLocalPort.

The local port number on which this EndPoint is listening, or 0 if this EndPoint does not represent a network connection.

getRemoteAddrback to summary
public String getRemoteAddr()

Implements org.mortbay.io.EndPoint.getRemoteAddr.

Returns:String

Doc from org.mortbay.io.EndPoint.getRemoteAddr.

The remote IP address to which this EndPoint is connected, or null if this EndPoint does not represent a network connection.

getRemoteHostback to summary
public String getRemoteHost()

Implements org.mortbay.io.EndPoint.getRemoteHost.

Returns:String

Doc from org.mortbay.io.EndPoint.getRemoteHost.

The host name of the remote machine to which this EndPoint is connected, or null if this EndPoint does not represent a network connection.

getRemotePortback to summary
public int getRemotePort()

Implements org.mortbay.io.EndPoint.getRemotePort.

Returns:int

Doc from org.mortbay.io.EndPoint.getRemotePort.

The remote port number to which this EndPoint is connected, or 0 if this EndPoint does not represent a network connection.

getTransportback to summary
public Object getTransport()

Implements org.mortbay.io.EndPoint.getTransport.

Returns:Object

Doc from org.mortbay.io.EndPoint.getTransport.

The underlying transport object (socket, channel, etc.)

isBlockingback to summary
public boolean isBlocking()

Implements org.mortbay.io.EndPoint.isBlocking.

isBufferingInputback to summary
public boolean isBufferingInput()

Implements org.mortbay.io.EndPoint.isBufferingInput.

Returns:boolean

Doc from org.mortbay.io.EndPoint.isBufferingInput.

True if the endpoint has some buffered input data

isBufferingOutputback to summary
public boolean isBufferingOutput()

Implements org.mortbay.io.EndPoint.isBufferingOutput.

Returns:boolean

Doc from org.mortbay.io.EndPoint.isBufferingOutput.

True if the endpoint has some buffered output data

isBufferredback to summary
public boolean isBufferred()

Implements org.mortbay.io.EndPoint.isBufferred.

isOpenback to summary
public boolean isOpen()

Implements org.mortbay.io.EndPoint.isOpen.