## org.eclipse.jetty.io
Interface EndPoint

All Known Subinterfaces:
  AsyncEndPoint, ConnectedEndPoint

All Known Implementing Classes:
  ByteArrayEndPoint, ChannelEndPoint, SelectChannelEndPoint, SocketConnector.ConnectorEndPoint, SocketEndPoint, SslSelectChannelEndPoint, SslSocketConnector.SslConnectorEndPoint, StreamEndPoint, StringEndPoint

    public interface EndPoint

A transport EndPoint

Method Summary
`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.
`java.lang.String` `getLocalAddr()`
`java.lang.String` `getLocalHost()`
`int` `getLocalPort()`
`int` `getMaxIdleTime()` Get the max idle time in ms.
`java.lang.String` `getRemoteAddr()`
`java.lang.String` `getRemoteHost()`
`int` `getRemotePort()`
`java.lang.Object` `getTransport()`
`boolean` `isBlocking()`
`boolean` `isBufferingInput()`
`boolean` `isBufferingOutput()`
`boolean` `isBufferred()`
`boolean` `isOpen()`
`void` `setMaxIdleTime(int timeMs)` Set the max idle time.
`void` `shutdownOutput()` Shutdown any backing output stream associated with the endpoint

Method Detail

### shutdownOutput

    void shutdownOutput()
                        throws java.io.IOException

  Shutdown any backing output stream associated with the endpoint

  Throws:
    `java.io.IOException`

### close

    void close()
               throws java.io.IOException

  Close any backing stream associated with the endpoint

  Throws:
    `java.io.IOException`

### fill

    int fill(Buffer buffer)
             throws java.io.IOException

  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:
    an `int` value indicating the number of bytes filled or -1 if EOF is reached.
  Throws:
    `java.io.IOException`

### flush

    int flush(Buffer buffer)
              throws java.io.IOException

  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` - The buffer to flush. This buffers getIndex is updated.
  Returns:
    the number of bytes written
  Throws:
    `java.io.IOException`

### flush

    int flush(Buffer header,
              Buffer buffer,
              Buffer trailer)
              throws java.io.IOException

  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` - 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.
  Returns:
    the total number of bytes written.
  Throws:
    `java.io.IOException`

### getLocalAddr

    java.lang.String getLocalAddr()

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

### getLocalHost

    java.lang.String getLocalHost()

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

### getLocalPort

    int getLocalPort()

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

### getRemoteAddr

    java.lang.String getRemoteAddr()

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

### getRemoteHost

    java.lang.String getRemoteHost()

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

### getRemotePort

    int getRemotePort()

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

### isBlocking

    boolean isBlocking()

### isBufferred

    boolean isBufferred()

### blockReadable

    boolean blockReadable(long millisecs)
                          throws java.io.IOException

  Throws:
    `java.io.IOException`

### blockWritable

    boolean blockWritable(long millisecs)
                          throws java.io.IOException

  Throws:
    `java.io.IOException`

### isOpen

    boolean isOpen()

### getTransport

    java.lang.Object getTransport()

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

### isBufferingInput

    boolean isBufferingInput()

  Returns:
    True if the endpoint has some buffered input data

### isBufferingOutput

    boolean isBufferingOutput()

  Returns:
    True if the endpoint has some buffered output data

### flush

    void flush()
               throws java.io.IOException

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

  Throws:
    `java.io.IOException`

### getMaxIdleTime

    int getMaxIdleTime()

  Get the max idle time in ms.

  The 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.

  Returns:
    the max idle time in ms.

### setMaxIdleTime

    void setMaxIdleTime(int timeMs)
                        throws java.io.IOException

  Set the max idle time.

  Parameters:
    `timeMs` - the max idle time in MS.
  Throws:
    `java.io.IOException` - if the timeout cannot be set.

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.