Class SWIFT_PING.Utils

  • Enclosing class:
    SWIFT_PING

    private static class SWIFT_PING.Utils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static SWIFT_PING.HttpResponse doOperation​(java.net.HttpURLConnection urlConnection, byte[] inputData, boolean hasOutput)
      Do a http operation
      static SWIFT_PING.HttpResponse doReadOperation​(java.net.HttpURLConnection urlConnection)
      Do a operation that reads from the httpconnection
      static SWIFT_PING.HttpResponse doSendOperation​(java.net.HttpURLConnection urlConnection, byte[] content)
      Do a operation that writes content to the HttpURLConnection
      static SWIFT_PING.HttpResponse doVoidOperation​(java.net.HttpURLConnection urlConnection)
      Do a operation that does not write or read from HttpURLConnection, except for the headers
      static byte[] getBytes​(java.io.InputStream inputStream)
      Get bytes of this InputStream
      static boolean isAuthDenied​(int code)
      Is http Unauthorized response code ?
      static boolean isSuccessCode​(int code)
      Is http response code in success range ?
      static void validateNotEmpty​(java.lang.String arg, java.lang.String argname)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        private Utils()
    • Method Detail

      • validateNotEmpty

        public static void validateNotEmpty​(java.lang.String arg,
                                            java.lang.String argname)
      • isSuccessCode

        public static boolean isSuccessCode​(int code)
        Is http response code in success range ?
        Parameters:
        code -
        Returns:
      • isAuthDenied

        public static boolean isAuthDenied​(int code)
        Is http Unauthorized response code ?
        Parameters:
        code -
        Returns:
      • doOperation

        public static SWIFT_PING.HttpResponse doOperation​(java.net.HttpURLConnection urlConnection,
                                                          byte[] inputData,
                                                          boolean hasOutput)
                                                   throws java.io.IOException
        Do a http operation
        Parameters:
        urlConnection - the HttpURLConnection to be used
        inputData - if not null,will be written to the urlconnection.
        hasOutput - if true, read content back from the urlconnection
        Returns:
        Response
        Throws:
        java.io.IOException
      • getBytes

        public static byte[] getBytes​(java.io.InputStream inputStream)
                               throws java.io.IOException
        Get bytes of this InputStream
        Parameters:
        inputStream -
        Returns:
        Throws:
        java.io.IOException
      • doVoidOperation

        public static SWIFT_PING.HttpResponse doVoidOperation​(java.net.HttpURLConnection urlConnection)
                                                       throws java.io.IOException
        Do a operation that does not write or read from HttpURLConnection, except for the headers
        Parameters:
        urlConnection - the connection
        Returns:
        Response
        Throws:
        java.io.IOException
      • doSendOperation

        public static SWIFT_PING.HttpResponse doSendOperation​(java.net.HttpURLConnection urlConnection,
                                                              byte[] content)
                                                       throws java.io.IOException
        Do a operation that writes content to the HttpURLConnection
        Parameters:
        urlConnection - the connection
        content - The content to send
        Returns:
        Response
        Throws:
        java.io.IOException
      • doReadOperation

        public static SWIFT_PING.HttpResponse doReadOperation​(java.net.HttpURLConnection urlConnection)
                                                       throws java.io.IOException
        Do a operation that reads from the httpconnection
        Parameters:
        urlConnection - The connections
        Returns:
        Response
        Throws:
        java.io.IOException