All Implemented Interfaces:
Serializable

public class I2PSocketExceptionextends SocketException
An I2P-specific IOException thrown from input and output streams, with a stored status code to be used for programmatic responses.
See Also:
  • Field Details

    • _status

      private final int _status
      Status code for the exception.
    • CUSTOM

      private static final int CUSTOM
      Sentinel for custom message exceptions.
      See Also:
    • BUNDLE_NAME

      private static final String BUNDLE_NAME
      Bundle name.
      See Also:
    • STATUS_CONNECTION_RESET

      public static final int STATUS_CONNECTION_RESET
      Router and I2CP status codes are 0 - 511. Start ours at 512.
      See Also:
  • Constructor Details

    • I2PSocketException

      public I2PSocketException(int status)
      Use canned message for this status code. Standard codes from the router are 0-255, defined in MessageStatusMessage. Standard codes from client-side I2CP are 256-511, defined in SendMessageStatusListener. Standard codes from streaming are 512-767, defined here.
      Parameters:
      status - >= 0 from MessageStatusMessage or SendMessageStatusListener
    • I2PSocketException

      public I2PSocketException(String message)
      Use message provided.
      Parameters:
      message - the detail message
  • Method Details

    • getStatus

      public int getStatus()
      For programmatic action based on specific failure code.
      Returns:
      the failure code, either a MessageStatusMessage status supplied to the integer constructor or -1 when the exception was constructed from a message alone
    • getMessage

      public String getMessage()
      For programmatic action based on specific failure code.
      Overrides:
      getMessage in class Throwable
      Returns:
      canned message based on status in int constructor or message from String constructor
    • getLocalizedMessage

      public String getLocalizedMessage()
      Looks up the message in the exception's translation bundle.
      Overrides:
      getLocalizedMessage in class Throwable
      Returns:
      the localized message
    • _t

      private static String _t(String s)
      Looks a string up in this class's translation bundle.
      Parameters:
      s - the string to look up
      Returns:
      the localized string, or s itself when no translation exists
    • _x

      private static String _x(String s)
      Tag for translation.
      Parameters:
      s - the string to mark for extraction
      Returns:
      the string, unchanged and untranslated