NioInetPeer (Apache Hadoop HDFS Client 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.net, class: NioInetPeer

Package org.apache.hadoop.hdfs.net

# Class NioInetPeer

java.lang.Object
org.apache.hadoop.hdfs.net.NioInetPeer

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `Peer`

public class NioInetPeer extends Object implements Peer
Represents a peer that we communicate with by using non-blocking I/O on a Socket.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NioInetPeer(Socket socket)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close the peer.
  `org.apache.hadoop.net.unix.DomainSocket`
  `getDomainSocket()`
  `InputStream`
  `getInputStream()`
  `ReadableByteChannel`
  `getInputStreamChannel()`
  `String`
  `getLocalAddressString()`
  `OutputStream`
  `getOutputStream()`
  `int`
  `getReceiveBufferSize()`
  `String`
  `getRemoteAddressString()`
  `boolean`
  `getTcpNoDelay()`
  `boolean`
  `hasSecureChannel()`
  Return true if the channel is secure.
  `boolean`
  `isClosed()`
  `boolean`
  `isLocal()`
  `void`
  `setReadTimeout(int timeoutMs)`
  Set the read timeout on this peer.
  `void`
  `setWriteTimeout(int timeoutMs)`
  Set the write timeout on this peer.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NioInetPeer

    public NioInetPeer(Socket socket) throws IOException
    Throws:
      `IOException`

- ## Method Details

  - ### getInputStreamChannel

    public ReadableByteChannel getInputStreamChannel()
    Specified by:
      `getInputStreamChannel` in interface `Peer`
    Returns:
      The input stream channel associated with this peer, or null if it has none.

  - ### setReadTimeout

    public void setReadTimeout(int timeoutMs) throws IOException
    Description copied from interface: `Peer`
    Set the read timeout on this peer.
    Specified by:
      `setReadTimeout` in interface `Peer`
    Parameters:
      `timeoutMs` - The timeout in milliseconds.
    Throws:
      `IOException`

  - ### getReceiveBufferSize

    public int getReceiveBufferSize() throws IOException
    Specified by:
      `getReceiveBufferSize` in interface `Peer`
    Returns:
      The receive buffer size.
    Throws:
      `IOException`

  - ### getTcpNoDelay

    public boolean getTcpNoDelay() throws IOException
    Specified by:
      `getTcpNoDelay` in interface `Peer`
    Returns:
      True if TCP_NODELAY is turned on.
    Throws:
      `IOException`

  - ### setWriteTimeout

    public void setWriteTimeout(int timeoutMs) throws IOException
    Description copied from interface: `Peer`
    Set the write timeout on this peer. Note: this is not honored for BasicInetPeer. See `BasicInetPeer.setWriteTimeout(int)` for details.
    Specified by:
      `setWriteTimeout` in interface `Peer`
    Parameters:
      `timeoutMs` - The timeout in milliseconds.
    Throws:
      `IOException`

  - ### isClosed

    public boolean isClosed()
    Specified by:
      `isClosed` in interface `Peer`
    Returns:
      true only if the peer is closed.

  - ### close

    public void close() throws IOException
    Description copied from interface: `Peer`
    Close the peer. It's safe to re-close a Peer that is already closed.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Specified by:
      `close` in interface `Peer`
    Throws:
      `IOException`

  - ### getRemoteAddressString

    public String getRemoteAddressString()
    Specified by:
      `getRemoteAddressString` in interface `Peer`
    Returns:
      A string representing the remote end of our connection to the peer.

  - ### getLocalAddressString

    public String getLocalAddressString()
    Specified by:
      `getLocalAddressString` in interface `Peer`
    Returns:
      A string representing the local end of our connection to the peer.

  - ### getInputStream

    public InputStream getInputStream() throws IOException
    Specified by:
      `getInputStream` in interface `Peer`
    Returns:
      An InputStream associated with the Peer. This InputStream will be valid until you close this peer with Peer#close.
    Throws:
      `IOException`

  - ### getOutputStream

    public OutputStream getOutputStream() throws IOException
    Specified by:
      `getOutputStream` in interface `Peer`
    Returns:
      An OutputStream associated with the Peer. This OutputStream will be valid until you close this peer with Peer#close.
    Throws:
      `IOException`

  - ### isLocal

    public boolean isLocal()
    Specified by:
      `isLocal` in interface `Peer`
    Returns:
      True if the peer resides on the same computer as we.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getDomainSocket

    public org.apache.hadoop.net.unix.DomainSocket getDomainSocket()
    Specified by:
      `getDomainSocket` in interface `Peer`
    Returns:
      The DomainSocket associated with the current peer, or null if there is none.

  - ### hasSecureChannel

    public boolean hasSecureChannel()
    Description copied from interface: `Peer`
    Return true if the channel is secure.
    Specified by:
      `hasSecureChannel` in interface `Peer`
    Returns:
      True if our channel to this peer is not susceptible to man-in-the-middle attacks.