Package py4j

Class NetworkUtil

java.lang.Object
py4j.NetworkUtil

public class NetworkUtil extends Object

Utility class used to perform network operations.

Author:
Barthelemy Dagenais
  • Constructor Details

    • NetworkUtil

      public NetworkUtil()
  • Method Details

    • safeReadLine

      public static String safeReadLine(BufferedReader reader, boolean addSpace) throws IOException
      Parameters:
      reader -
      addSpace -
      Returns:
      A non-null String with an optional space if it is empty.
      Throws:
      IOException
    • safeReadLine

      public static String safeReadLine(BufferedReader reader) throws IOException
      Parameters:
      reader -
      Returns:
      A String of at least one character (space if null or empty).
      Throws:
      IOException
    • quietlyClose

      public static void quietlyClose(Closeable closeable)
    • quietlyClose

      public static void quietlyClose(ServerSocket closeable)
    • quietlyClose

      public static void quietlyClose(Socket closeable)
    • quietlySetLinger

      public static void quietlySetLinger(Socket socket)

      Will send a RST packet on close, which should make both remote write and read operations fail.

      Parameters:
      socket -