NIOSynchChannel (ActiveIO 1.0 API)
Keywords: org.activeio.net.NIOSynchChannel class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.activeio.net
Class NIOSynchChannel

    java.lang.Object
      org.activeio.net.NIOBaseChannel
          org.activeio.net.NIOSynchChannel

All Implemented Interfaces:
  Channel, Disposable, InputSynchChannel, OutputChannel, Service, SocketMetadata, SynchChannel

public final class NIOSynchChannel
extends NIOBaseChannel
implements SynchChannel

A `SynchChannel` implementation that uses a `SocketChannel` to talk to the network. Using a SocketChannelSynchChannel should be more efficient than using a SocketSynchChannel since direct ByteBuffer can be used to reduce the jvm overhead needed to copy byte[]s.

Version:
  $Revision$

Field Summary

Fields inherited from class org.activeio.net.NIOBaseChannel
`socket, socketChannel`

Fields inherited from interface org.activeio.Service
`NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT`

Constructor Summary
`protected` | `NIOSynchChannel(java.nio.channels.SocketChannel socketChannel)`
`protected` | `NIOSynchChannel(java.nio.channels.SocketChannel socketChannel, boolean useDirect)`

Method Summary
`Packet` | `read(long timeout)` Used to synchonously receive a packet of information going 'up' the channel.
`void` | `start()` Starts the channel.
`void` | `stop(long timeout)` Stops the channel.
`void` | `write(Packet packet)` Sends a packet down the channel towards the media.

Methods inherited from class org.activeio.net.NIOBaseChannel
`allocateBuffer, dispose, flush, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, narrow, setKeepAlive, setOOBInline, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.activeio.OutputChannel
`flush`

Methods inherited from interface org.activeio.Channel
`narrow`

Methods inherited from interface org.activeio.Disposable
`dispose`

Constructor Detail

### NIOSynchChannel

    protected NIOSynchChannel(java.nio.channels.SocketChannel socketChannel)
                       throws java.io.IOException

### NIOSynchChannel

    protected NIOSynchChannel(java.nio.channels.SocketChannel socketChannel,
                              boolean useDirect)
                       throws java.io.IOException

Method Detail

### read

    public Packet read(long timeout)
                throws java.io.IOException

  Description copied from interface: `InputSynchChannel`
  Used to synchonously receive a packet of information going 'up' the channel. This method blocks until a packet is received or the operation experiences timeout.

  Specified by:
    `read` in interface `InputSynchChannel`
  Parameters:
    `timeout` -
  Returns:
    the packet recived or null if the timeout occured.
  Throws:
    `java.io.IOException`

### write

    public void write(Packet packet)
               throws java.io.IOException

  Description copied from interface: `OutputChannel`
  Sends a packet down the channel towards the media.

  Specified by:
    `write` in interface `OutputChannel`
  Parameters:
    `packet` -
  Throws:
    `java.io.IOException`

### start

    public void start()
               throws java.io.IOException

  Description copied from interface: `Service`
  Starts the channel. Once started, the channel is in the running state.

  Specified by:
    `start` in interface `Service`
  Throws:
    `java.io.IOException`

### stop

    public void stop(long timeout)
              throws java.io.IOException

  Description copied from interface: `Service`
  Stops the channel. Once stopped, the channel is in the stopped state.

  Specified by:
    `stop` in interface `Service`
  Parameters:
    `timeout` - The amount of time the channel is allowed to take to gracefully stop. If the timeout is exceeded, the channel should do a forcefull stop.
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © -2005 The ActiveIO Project. All Rights Reserved.