Class NioSocketUDT

All Implemented Interfaces:
IceCommon, IceSocket, Closeable, AutoCloseable

public class NioSocketUDT extends NetSocketUDT
  • Field Details

  • Constructor Details

  • Method Details

    • getChannel

      public SocketChannelUDT getChannel()
      Description copied from interface: IceSocket
      Returns the unique SocketChannel object associated with this socket, if any.

      A socket will have a channel if, and only if, the channel itself was created via the SocketChannel.open or ServerSocketChannel.accept methods.

      Specified by:
      getChannel in interface IceSocket
      Overrides:
      getChannel in class NetSocketUDT
      Returns:
      the socket channel associated with this socket, or null if this socket was not created for a channel
    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: IceSocket
      Returns an input stream for this socket.

      If this socket has an associated channel then the resulting input stream delegates all of its operations to the channel. If the channel is in non-blocking mode then the input stream's read operations will throw an IllegalBlockingModeException.

      Under abnormal conditions the underlying connection may be broken by the remote host or the network software (for example a connection reset in the case of TCP connections). When a broken connection is detected by the network software the following applies to the returned input stream :-

      • The network software may discard bytes that are buffered by the socket. Bytes that aren't discarded by the network software can be read using read.

      • If there are no bytes buffered on the socket, or all buffered bytes have been consumed by read, then all subsequent calls to read will throw an IOException.

      • If there are no bytes buffered on the socket, and the socket has not been closed using close, then available will return 0.

      Closing the returned InputStream will close the associated socket.

      Specified by:
      getInputStream in interface IceSocket
      Overrides:
      getInputStream in class NetSocketUDT
      Returns:
      an input stream for reading bytes from this socket.
      Throws:
      IOException - if an I/O error occurs when creating the input stream, the socket is closed, the socket is not connected, or the socket input has been shutdown using IceSocket.shutdownInput() revised 1.4 spec JSR-51
    • getOutputStream

      public OutputStream getOutputStream() throws IOException
      Description copied from interface: IceSocket
      Returns an output stream for this socket.

      If this socket has an associated channel then the resulting output stream delegates all of its operations to the channel. If the channel is in non-blocking mode then the output stream's write operations will throw an IllegalBlockingModeException.

      Closing the returned OutputStream will close the associated socket.

      Specified by:
      getOutputStream in interface IceSocket
      Overrides:
      getOutputStream in class NetSocketUDT
      Returns:
      an output stream for writing bytes to this socket.
      Throws:
      IOException - if an I/O error occurs when creating the output stream or if the socket is not connected. revised 1.4 spec JSR-51