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

## com.connecterra.ale.reader
Class CharacterStreamDeviceChannel

    java.lang.Object
      com.connecterra.ale.reader.DeviceChannel
          com.connecterra.ale.reader.SocketDeviceChannel
              com.connecterra.ale.reader.CharacterStreamDeviceChannel

    public class CharacterStreamDeviceChannel

extends com.connecterra.ale.reader.SocketDeviceChannel

A DeviceChannel implemented by a TCP connection initiated by the device driver. It extends the SocketDeviceChannel to provide a character-based interface and buffering on input.

Nested Class Summary

Nested classes/interfaces inherited from class com.connecterra.ale.reader.SocketDeviceChannel
`com.connecterra.ale.reader.SocketDeviceChannel.BlockingSocketInputListener, com.connecterra.ale.reader.SocketDeviceChannel.SocketInputListener`

Nested classes/interfaces inherited from class com.connecterra.ale.reader.DeviceChannel
`DeviceChannel.AbstractOpenChannel, DeviceChannel.MarkingInputStream`

Constructor Summary
`CharacterStreamDeviceChannel(PluginConfig config)` Creates a new `CharacterStreamDeviceChannel` instance where the remote host is read from the `hostname` and `port` parameters in the given `PluginConfig`.
`CharacterStreamDeviceChannel(PluginConfig config, String portName)` Creates a new `CharacterStreamDeviceChannel` instance where the remote host is read from the `hostname` parameter and the remote port is read from the parameter named by the `portName` argument in the given `PluginConfig`.

Method Summary
`BufferedReader` | `getReader()` Returns a BufferedReader for reading from an open channel.
`Writer` | `getWriter()`
`boolean` | `ready()`

Methods inherited from class com.connecterra.ale.reader.SocketDeviceChannel
`addDeviceAttributes, addToPluginMeta, addToPluginMeta, close, getHostname, getInputStream, getOutputStream, getPort, getSocket, open, setBlockingListener, setListener, toString`

Methods inherited from class com.connecterra.ale.reader.DeviceChannel
`getLogger, getReactor, markUsed, reactivateChannels`

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

Constructor Detail

### CharacterStreamDeviceChannel

    public CharacterStreamDeviceChannel(PluginConfig config,
                                        String portName)
                                 throws com.connecterra.ale.resources.PluginLoadException

  Creates a new `CharacterStreamDeviceChannel` instance where the remote host is read from the `hostname` parameter and the remote port is read from the parameter named by the `portName` argument in the given `PluginConfig`. The timeout for socket operations is read from the `socketTimeout` parameter in the PluginConfig.

  Parameters:
    `config` - a `PluginConfig` value
    `portName` - the `String` key name of the endpoint port parameter
  Throws:
    `com.connecterra.ale.resources.PluginLoadException` - if a configuration error occurs

### CharacterStreamDeviceChannel

    public CharacterStreamDeviceChannel(PluginConfig config)
                                 throws com.connecterra.ale.resources.PluginLoadException

  Creates a new `CharacterStreamDeviceChannel` instance where the remote host is read from the `hostname` and `port` parameters in the given `PluginConfig`. The timeout for socket operations is read from the `socketTimeout` parameter in the PluginConfig.

  Parameters:
    `config` - a `PluginConfig` value
  Throws:
    `com.connecterra.ale.resources.PluginLoadException` - if a configuration error occurs

Method Detail

### getWriter

    public Writer getWriter()
                     throws IOException

  Returns:
    a `Writer` for writing to an open channel.
  Throws:
    `IOException` - if the channel is not open

### getReader

    public BufferedReader getReader()
                             throws IOException

  Returns a BufferedReader for reading from an open channel.

  If this method is used by a driver which expects to receive data asynchronously, and this method is used to read a synchronous result from a command, then there is a pitfall to avoid: if the device sent asynchronous data before the synchronous command was received and processed, then the command "response" may actually be the asynchronous data. The reader should be aware of this, and be prepared to handle the asynchronous data, either immediately or by queueing it for later processing.

  Returns:
    a `BufferedReader` for reading from an open channel.
  Throws:
    `IOException` - if the channel is not open

### ready

    public boolean ready()
                  throws IOException

  Overrides:
    `ready` in class `com.connecterra.ale.reader.SocketDeviceChannel`
  Returns:
    true if an input operation on the result of `CharacterStreamDeviceChannel.getReader()` is guaranteed not to block
  Throws:
    `IOException` - if the channel is not open

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at ${DOCSWEBROOT} Copyright 2007 BEA Systems Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD