Class NSURLSession

    • Constructor Detail

      • NSURLSession

        protected NSURLSession​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static NSURLSession allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • new_objc

        @Deprecated
        public static NSURLSession new_objc()
        Deprecated.
        API-Since: 7.0 Deprecated-Since: 13.0 Deprecated-Message: Please use +[NSURLSession sessionWithConfiguration:] or other class methods to create instances
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • sessionWithConfiguration

        @NotNull
        public static @NotNull NSURLSession sessionWithConfiguration​(@NotNull
                                                                     @NotNull NSURLSessionConfiguration configuration)
        Customization of NSURLSession occurs during creation of a new session. If you only need to use the convenience routines with custom configuration options it is not necessary to specify a delegate. If you do specify a delegate, the delegate will be retained until after the delegate has been sent the URLSession:didBecomeInvalidWithError: message.
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • sharedSession

        @NotNull
        public static @NotNull NSURLSession sharedSession()
        The shared session uses the currently set global NSURLCache, NSHTTPCookieStorage and NSURLCredentialStorage objects.
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • dataTaskWithRequest

        @NotNull
        public @NotNull NSURLSessionDataTask dataTaskWithRequest​(@NotNull
                                                                 @NotNull NSURLRequest request)
        Creates a data task with the given request. The request may have a body stream.
      • dataTaskWithRequestCompletionHandler

        @NotNull
        public @NotNull NSURLSessionDataTask dataTaskWithRequestCompletionHandler​(@NotNull
                                                                                  @NotNull NSURLRequest request,
                                                                                  @NotNull
                                                                                  @NotNull NSURLSession.Block_dataTaskWithRequestCompletionHandler completionHandler)
        data task convenience methods. These methods create tasks that bypass the normal delegate calls for response and data delivery, and provide a simple cancelable asynchronous interface to receiving data. Errors will be returned in the NSURLErrorDomain, see . The delegate, if any, will still be called for authentication challenges.
      • dataTaskWithURL

        @NotNull
        public @NotNull NSURLSessionDataTask dataTaskWithURL​(@NotNull
                                                             @NotNull NSURL url)
        Creates a data task to retrieve the contents of the given URL.
      • downloadTaskWithRequest

        @NotNull
        public @NotNull NSURLSessionDownloadTask downloadTaskWithRequest​(@NotNull
                                                                         @NotNull NSURLRequest request)
        Creates a download task with the given request.
      • downloadTaskWithRequestCompletionHandler

        @NotNull
        public @NotNull NSURLSessionDownloadTask downloadTaskWithRequestCompletionHandler​(@NotNull
                                                                                          @NotNull NSURLRequest request,
                                                                                          @NotNull
                                                                                          @NotNull NSURLSession.Block_downloadTaskWithRequestCompletionHandler completionHandler)
        download task convenience methods. When a download successfully completes, the NSURL will point to a file that must be read or copied during the invocation of the completion routine. The file will be removed automatically.
      • downloadTaskWithResumeData

        @NotNull
        public @NotNull NSURLSessionDownloadTask downloadTaskWithResumeData​(@NotNull
                                                                            @NotNull NSData resumeData)
        Creates a download task with the resume data. If the download cannot be successfully resumed, URLSession:task:didCompleteWithError: will be called.
      • downloadTaskWithURL

        @NotNull
        public @NotNull NSURLSessionDownloadTask downloadTaskWithURL​(@NotNull
                                                                     @NotNull NSURL url)
        Creates a download task to download the contents of the given URL.
      • finishTasksAndInvalidate

        public void finishTasksAndInvalidate()
        -finishTasksAndInvalidate returns immediately and existing tasks will be allowed to run to completion. New tasks may not be created. The session will continue to make delegate callbacks until URLSession:didBecomeInvalidWithError: has been issued. -finishTasksAndInvalidate and -invalidateAndCancel do not have any effect on the shared session singleton. When invalidating a background session, it is not safe to create another background session with the same identifier until URLSession:didBecomeInvalidWithError: has been issued.
      • flushWithCompletionHandler

        public void flushWithCompletionHandler​(@NotNull
                                               @NotNull NSURLSession.Block_flushWithCompletionHandler completionHandler)
        flush storage to disk and clear transient network caches. Invokes completionHandler() on the delegate queue.
      • getTasksWithCompletionHandler

        public void getTasksWithCompletionHandler​(@NotNull
                                                  @NotNull NSURLSession.Block_getTasksWithCompletionHandler completionHandler)
        invokes completionHandler with outstanding data, upload and download tasks.
      • init

        @Deprecated
        public NSURLSession init()
        Deprecated.
        API-Since: 7.0 Deprecated-Since: 13.0 Deprecated-Message: Please use +[NSURLSession sessionWithConfiguration:] or other class methods to create instances
        Overrides:
        init in class NSObject
      • invalidateAndCancel

        public void invalidateAndCancel()
        -invalidateAndCancel acts as -finishTasksAndInvalidate, but issues -cancel to all outstanding tasks for this session. Note task cancellation is subject to the state of the task, and some tasks may have already have completed at the time they are sent -cancel.
      • resetWithCompletionHandler

        public void resetWithCompletionHandler​(@NotNull
                                               @NotNull NSURLSession.Block_resetWithCompletionHandler completionHandler)
        empty all cookies, cache and credential stores, removes disk files, issues -flushWithCompletionHandler:. Invokes completionHandler() on the delegate queue.
      • sessionDescription

        @Nullable
        public @Nullable java.lang.String sessionDescription()
        The sessionDescription property is available for the developer to provide a descriptive label for the session.
      • setSessionDescription

        public void setSessionDescription​(@Nullable
                                          @Nullable java.lang.String value)
        The sessionDescription property is available for the developer to provide a descriptive label for the session.
      • streamTaskWithHostNamePort

        @NotNull
        public @NotNull NSURLSessionStreamTask streamTaskWithHostNamePort​(@NotNull
                                                                          @NotNull java.lang.String hostname,
                                                                          long port)
        Creates a bidirectional stream task to a given host and port. API-Since: 9.0
      • streamTaskWithNetService

        @NotNull
        @Deprecated
        public @NotNull NSURLSessionStreamTask streamTaskWithNetService​(@NotNull
                                                                        @NotNull NSNetService service)
        Deprecated.
        Creates a bidirectional stream task with an NSNetService to identify the endpoint. The NSNetService will be resolved before any IO completes. API-Since: 9.0 Deprecated-Since: 100000.0 Deprecated-Message: Use nw_connection_t in Network framework instead
      • uploadTaskWithRequestFromData

        @NotNull
        public @NotNull NSURLSessionUploadTask uploadTaskWithRequestFromData​(@NotNull
                                                                             @NotNull NSURLRequest request,
                                                                             @NotNull
                                                                             @NotNull NSData bodyData)
        Creates an upload task with the given request. The body of the request is provided from the bodyData.
      • uploadTaskWithRequestFromFile

        @NotNull
        public @NotNull NSURLSessionUploadTask uploadTaskWithRequestFromFile​(@NotNull
                                                                             @NotNull NSURLRequest request,
                                                                             @NotNull
                                                                             @NotNull NSURL fileURL)
        Creates an upload task with the given request. The body of the request will be created from the file referenced by fileURL
      • uploadTaskWithStreamedRequest

        @NotNull
        public @NotNull NSURLSessionUploadTask uploadTaskWithStreamedRequest​(@NotNull
                                                                             @NotNull NSURLRequest request)
        Creates an upload task with the given request. The previously set body stream of the request (if any) is ignored and the URLSession:task:needNewBodyStream: delegate will be called when the body payload is required.
      • webSocketTaskWithRequest

        @NotNull
        public @NotNull NSURLSessionWebSocketTask webSocketTaskWithRequest​(@NotNull
                                                                           @NotNull NSURLRequest request)
        Creates a WebSocket task given the request. The request properties can be modified and will be used by the task during the HTTP handshake phase. Clients who want to add custom protocols can do so by directly adding headers with the key Sec-WebSocket-Protocol and a comma separated list of protocols they wish to negotiate with the server. The custom HTTP headers provided by the client will remain unchanged for the handshake with the server. API-Since: 13.0
      • webSocketTaskWithURL

        @NotNull
        public @NotNull NSURLSessionWebSocketTask webSocketTaskWithURL​(@NotNull
                                                                       @NotNull NSURL url)
        Creates a WebSocket task given the url. The given url must have a ws or wss scheme. API-Since: 13.0
      • webSocketTaskWithURLProtocols

        @NotNull
        public @NotNull NSURLSessionWebSocketTask webSocketTaskWithURLProtocols​(@NotNull
                                                                                @NotNull NSURL url,
                                                                                @NotNull
                                                                                @NotNull NSArray<java.lang.String> protocols)
        Creates a WebSocket task given the url and an array of protocols. The protocols will be used in the WebSocket handshake to negotiate a preferred protocol with the server Note - The protocol will not affect the WebSocket framing. More details on the protocol can be found by reading the WebSocket RFC API-Since: 13.0
      • uploadTaskWithResumeData

        @NotNull
        public @NotNull NSURLSessionUploadTask uploadTaskWithResumeData​(@NotNull
                                                                        @NotNull NSData resumeData)
        Creates an upload task from a resume data blob. Requires the server to support the latest resumable uploads Internet-Draft from the HTTP Working Group, found at https://datatracker.ietf.org/doc/draft-ietf-httpbis-resumable-upload/ If resuming from an upload file, the file must still exist and be unmodified. If the upload cannot be successfully resumed, URLSession:task:didCompleteWithError: will be called. - Parameter resumeData: Resume data blob from an incomplete upload, such as data returned by the cancelByProducingResumeData: method. - Returns: A new session upload task, or nil if the resumeData is invalid. API-Since: 17.0
      • uploadTaskWithResumeDataCompletionHandler

        @NotNull
        public @NotNull NSURLSessionUploadTask uploadTaskWithResumeDataCompletionHandler​(@NotNull
                                                                                         @NotNull NSData resumeData,
                                                                                         @NotNull
                                                                                         @NotNull NSURLSession.Block_uploadTaskWithResumeDataCompletionHandler completionHandler)
        Creates a URLSessionUploadTask from a resume data blob. If resuming from an upload file, the file must still exist and be unmodified. - Parameter resumeData: Resume data blob from an incomplete upload, such as data returned by the cancelByProducingResumeData: method. - Parameter completionHandler: The completion handler to call when the load request is complete. - Returns: A new session upload task, or nil if the resumeData is invalid. API-Since: 17.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.