Package apple.foundation
Class NSURLSession
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.foundation.NSURLSession
-
- All Implemented Interfaces:
NSObject
- Direct Known Subclasses:
AVAssetDownloadURLSession
public class NSURLSession extends NSObject
API-Since: 7.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNSURLSession.Block_dataTaskWithRequestCompletionHandlerstatic interfaceNSURLSession.Block_dataTaskWithURLCompletionHandlerstatic interfaceNSURLSession.Block_downloadTaskWithRequestCompletionHandlerstatic interfaceNSURLSession.Block_downloadTaskWithResumeDataCompletionHandlerstatic interfaceNSURLSession.Block_downloadTaskWithURLCompletionHandlerstatic interfaceNSURLSession.Block_flushWithCompletionHandlerstatic interfaceNSURLSession.Block_getAllTasksWithCompletionHandlerstatic interfaceNSURLSession.Block_getTasksWithCompletionHandlerstatic interfaceNSURLSession.Block_resetWithCompletionHandlerstatic interfaceNSURLSession.Block_uploadTaskWithRequestFromDataCompletionHandlerstatic interfaceNSURLSession.Block_uploadTaskWithRequestFromFileCompletionHandlerstatic interfaceNSURLSession.Block_uploadTaskWithResumeDataCompletionHandler-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Block_accessibilityActivateBlock_ret, NSObject.Block_accessibilityActivationPointBlock_ret, NSObject.Block_accessibilityAttributedHintBlock_ret, NSObject.Block_accessibilityAttributedLabelBlock_ret, NSObject.Block_accessibilityAttributedUserInputLabelsBlock_ret, NSObject.Block_accessibilityAttributedValueBlock_ret, NSObject.Block_accessibilityContainerTypeBlock_ret, NSObject.Block_accessibilityCustomActionsBlock_ret, NSObject.Block_accessibilityCustomRotorsBlock_ret, NSObject.Block_accessibilityDecrementBlock_ret, NSObject.Block_accessibilityElementsBlock_ret, NSObject.Block_accessibilityElementsHiddenBlock_ret, NSObject.Block_accessibilityFrameBlock_ret, NSObject.Block_accessibilityHeaderElementsBlock_ret, NSObject.Block_accessibilityHintBlock_ret, NSObject.Block_accessibilityIdentifierBlock_ret, NSObject.Block_accessibilityIncrementBlock_ret, NSObject.Block_accessibilityLabelBlock_ret, NSObject.Block_accessibilityLanguageBlock_ret, NSObject.Block_accessibilityMagicTapBlock_ret, NSObject.Block_accessibilityNavigationStyleBlock_ret, NSObject.Block_accessibilityPathBlock_ret, NSObject.Block_accessibilityPerformEscapeBlock_ret, NSObject.Block_accessibilityRespondsToUserInteractionBlock_ret, NSObject.Block_accessibilityShouldGroupAccessibilityChildrenBlock_ret, NSObject.Block_accessibilityTextualContextBlock_ret, NSObject.Block_accessibilityTraitsBlock_ret, NSObject.Block_accessibilityUserInputLabelsBlock_ret, NSObject.Block_accessibilityValueBlock_ret, NSObject.Block_accessibilityViewIsModalBlock_ret, NSObject.Block_automationElementsBlock_ret, NSObject.Block_isAccessibilityElementBlock_ret, NSObject.Block_setAccessibilityActivateBlock, NSObject.Block_setAccessibilityActivationPointBlock, NSObject.Block_setAccessibilityAttributedHintBlock, NSObject.Block_setAccessibilityAttributedLabelBlock, NSObject.Block_setAccessibilityAttributedUserInputLabelsBlock, NSObject.Block_setAccessibilityAttributedValueBlock, NSObject.Block_setAccessibilityContainerTypeBlock, NSObject.Block_setAccessibilityCustomActionsBlock, NSObject.Block_setAccessibilityCustomRotorsBlock, NSObject.Block_setAccessibilityDecrementBlock, NSObject.Block_setAccessibilityElementsBlock, NSObject.Block_setAccessibilityElementsHiddenBlock, NSObject.Block_setAccessibilityFrameBlock, NSObject.Block_setAccessibilityHeaderElementsBlock, NSObject.Block_setAccessibilityHintBlock, NSObject.Block_setAccessibilityIdentifierBlock, NSObject.Block_setAccessibilityIncrementBlock, NSObject.Block_setAccessibilityLabelBlock, NSObject.Block_setAccessibilityLanguageBlock, NSObject.Block_setAccessibilityMagicTapBlock, NSObject.Block_setAccessibilityNavigationStyleBlock, NSObject.Block_setAccessibilityPathBlock, NSObject.Block_setAccessibilityPerformEscapeBlock, NSObject.Block_setAccessibilityRespondsToUserInteractionBlock, NSObject.Block_setAccessibilityShouldGroupAccessibilityChildrenBlock, NSObject.Block_setAccessibilityTextualContextBlock, NSObject.Block_setAccessibilityTraitsBlock, NSObject.Block_setAccessibilityUserInputLabelsBlock, NSObject.Block_setAccessibilityValueBlock, NSObject.Block_setAccessibilityViewIsModalBlock, NSObject.Block_setAutomationElementsBlock, NSObject.Block_setIsAccessibilityElementBlock, NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNSURLSession(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static NSURLSessionalloc()static NSURLSessionallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(@NotNull java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(@NotNull java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(@NotNull java.lang.Object aTarget, @NotNull org.moe.natj.objc.SEL aSelector, @Nullable java.lang.Object anArgument)static @NotNull NSArray<java.lang.String>classFallbacksForKeyedArchiver()static @NotNull org.moe.natj.objc.ClassclassForKeyedUnarchiver()@NotNull NSURLSessionConfigurationconfiguration()@NotNull NSURLSessionDataTaskdataTaskWithRequest(@NotNull NSURLRequest request)Creates a data task with the given request.@NotNull NSURLSessionDataTaskdataTaskWithRequestCompletionHandler(@NotNull NSURLRequest request, @NotNull NSURLSession.Block_dataTaskWithRequestCompletionHandler completionHandler)data task convenience methods.@NotNull NSURLSessionDataTaskdataTaskWithURL(@NotNull NSURL url)Creates a data task to retrieve the contents of the given URL.@NotNull NSURLSessionDataTaskdataTaskWithURLCompletionHandler(@NotNull NSURL url, @NotNull NSURLSession.Block_dataTaskWithURLCompletionHandler completionHandler)static java.lang.StringdebugDescription_static()@Nullable NSURLSessionDelegatedelegate()@NotNull NSOperationQueuedelegateQueue()static java.lang.Stringdescription_static()@NotNull NSURLSessionDownloadTaskdownloadTaskWithRequest(@NotNull NSURLRequest request)Creates a download task with the given request.@NotNull NSURLSessionDownloadTaskdownloadTaskWithRequestCompletionHandler(@NotNull NSURLRequest request, @NotNull NSURLSession.Block_downloadTaskWithRequestCompletionHandler completionHandler)download task convenience methods.@NotNull NSURLSessionDownloadTaskdownloadTaskWithResumeData(@NotNull NSData resumeData)Creates a download task with the resume data.@NotNull NSURLSessionDownloadTaskdownloadTaskWithResumeDataCompletionHandler(@NotNull NSData resumeData, @NotNull NSURLSession.Block_downloadTaskWithResumeDataCompletionHandler completionHandler)@NotNull NSURLSessionDownloadTaskdownloadTaskWithURL(@NotNull NSURL url)Creates a download task to download the contents of the given URL.@NotNull NSURLSessionDownloadTaskdownloadTaskWithURLCompletionHandler(@NotNull NSURL url, @NotNull NSURLSession.Block_downloadTaskWithURLCompletionHandler completionHandler)voidfinishTasksAndInvalidate()-finishTasksAndInvalidate returns immediately and existing tasks will be allowed to run to completion.voidflushWithCompletionHandler(@NotNull NSURLSession.Block_flushWithCompletionHandler completionHandler)flush storage to disk and clear transient network caches.voidgetAllTasksWithCompletionHandler(@NotNull NSURLSession.Block_getAllTasksWithCompletionHandler completionHandler)invokes completionHandler with all outstanding tasks.voidgetTasksWithCompletionHandler(@NotNull NSURLSession.Block_getTasksWithCompletionHandler completionHandler)invokes completionHandler with outstanding data, upload and download tasks.static longhash_static()NSURLSessioninit()Deprecated.static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)voidinvalidateAndCancel()-invalidateAndCancel acts as -finishTasksAndInvalidate, but issues -cancel to all outstanding tasks for this session.static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static @NotNull NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(@NotNull java.lang.String key)static NSURLSessionnew_objc()Deprecated.voidresetWithCompletionHandler(@NotNull NSURLSession.Block_resetWithCompletionHandler completionHandler)empty all cookies, cache and credential stores, removes disk files, issues -flushWithCompletionHandler:.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)@Nullable java.lang.StringsessionDescription()The sessionDescription property is available for the developer to provide a descriptive label for the session.static @NotNull NSURLSessionsessionWithConfiguration(@NotNull NSURLSessionConfiguration configuration)Customization of NSURLSession occurs during creation of a new session.static @NotNull NSURLSessionsessionWithConfigurationDelegateDelegateQueue(@NotNull NSURLSessionConfiguration configuration, @Nullable NSURLSessionDelegate delegate, @Nullable NSOperationQueue queue)voidsetSessionDescription(@Nullable java.lang.String value)The sessionDescription property is available for the developer to provide a descriptive label for the session.static voidsetVersion_static(long aVersion)static @NotNull NSURLSessionsharedSession()The shared session uses the currently set global NSURLCache, NSHTTPCookieStorage and NSURLCredentialStorage objects.@NotNull NSURLSessionStreamTaskstreamTaskWithHostNamePort(@NotNull java.lang.String hostname, long port)Creates a bidirectional stream task to a given host and port.@NotNull NSURLSessionStreamTaskstreamTaskWithNetService(@NotNull NSNetService service)Deprecated.static org.moe.natj.objc.Classsuperclass_static()@NotNull NSURLSessionUploadTaskuploadTaskWithRequestFromData(@NotNull NSURLRequest request, @NotNull NSData bodyData)Creates an upload task with the given request.@NotNull NSURLSessionUploadTaskuploadTaskWithRequestFromDataCompletionHandler(@NotNull NSURLRequest request, @Nullable NSData bodyData, @NotNull NSURLSession.Block_uploadTaskWithRequestFromDataCompletionHandler completionHandler)@NotNull NSURLSessionUploadTaskuploadTaskWithRequestFromFile(@NotNull NSURLRequest request, @NotNull NSURL fileURL)Creates an upload task with the given request.@NotNull NSURLSessionUploadTaskuploadTaskWithRequestFromFileCompletionHandler(@NotNull NSURLRequest request, @NotNull NSURL fileURL, @NotNull NSURLSession.Block_uploadTaskWithRequestFromFileCompletionHandler completionHandler)upload convenience method.@NotNull NSURLSessionUploadTaskuploadTaskWithResumeData(@NotNull NSData resumeData)Creates an upload task from a resume data blob.@NotNull NSURLSessionUploadTaskuploadTaskWithResumeDataCompletionHandler(@NotNull NSData resumeData, @NotNull NSURLSession.Block_uploadTaskWithResumeDataCompletionHandler completionHandler)Creates a URLSessionUploadTask from a resume data blob.@NotNull NSURLSessionUploadTaskuploadTaskWithStreamedRequest(@NotNull NSURLRequest request)Creates an upload task with the given request.static booleanuseStoredAccessor()Deprecated.static longversion_static()@NotNull NSURLSessionWebSocketTaskwebSocketTaskWithRequest(@NotNull NSURLRequest request)Creates a WebSocket task given the request.@NotNull NSURLSessionWebSocketTaskwebSocketTaskWithURL(@NotNull NSURL url)Creates a WebSocket task given the url.@NotNull NSURLSessionWebSocketTaskwebSocketTaskWithURLProtocols(@NotNull NSURL url, @NotNull NSArray<java.lang.String> protocols)Creates a WebSocket task given the url and an array of protocols.-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivateBlock, accessibilityActivationPoint, accessibilityActivationPointBlock, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedHintBlock, accessibilityAttributedLabel, accessibilityAttributedLabelBlock, accessibilityAttributedUserInputLabels, accessibilityAttributedUserInputLabelsBlock, accessibilityAttributedValue, accessibilityAttributedValueBlock, accessibilityContainerType, accessibilityContainerTypeBlock, accessibilityCustomActions, accessibilityCustomActionsBlock, accessibilityCustomRotors, accessibilityCustomRotorsBlock, accessibilityDecrement, accessibilityDecrementBlock, accessibilityDirectTouchOptions, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsBlock, accessibilityElementsHidden, accessibilityElementsHiddenBlock, accessibilityFrame, accessibilityFrameBlock, accessibilityHeaderElementsBlock, accessibilityHint, accessibilityHintBlock, accessibilityIdentifierBlock, accessibilityIncrement, accessibilityIncrementBlock, accessibilityLabel, accessibilityLabelBlock, accessibilityLanguage, accessibilityLanguageBlock, accessibilityMagicTapBlock, accessibilityNavigationStyle, accessibilityNavigationStyleBlock, accessibilityPath, accessibilityPathBlock, accessibilityPerformEscape, accessibilityPerformEscapeBlock, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityRespondsToUserInteractionBlock, accessibilityScroll, accessibilityShouldGroupAccessibilityChildrenBlock, accessibilityTextualContext, accessibilityTextualContextBlock, accessibilityTraits, accessibilityTraitsBlock, accessibilityUserInputLabels, accessibilityUserInputLabelsBlock, accessibilityValue, accessibilityValueBlock, accessibilityViewIsModal, accessibilityViewIsModalBlock, accessibilityZoomInAtPoint, accessibilityZoomOutAtPoint, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, automationElements, automationElementsBlock, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hash, indexOfAccessibilityElement, isAccessibilityElement, isAccessibilityElementBlock, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivateBlock, setAccessibilityActivationPoint, setAccessibilityActivationPointBlock, setAccessibilityAttributedHint, setAccessibilityAttributedHintBlock, setAccessibilityAttributedLabel, setAccessibilityAttributedLabelBlock, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedUserInputLabelsBlock, setAccessibilityAttributedValue, setAccessibilityAttributedValueBlock, setAccessibilityContainerType, setAccessibilityContainerTypeBlock, setAccessibilityCustomActions, setAccessibilityCustomActionsBlock, setAccessibilityCustomRotors, setAccessibilityCustomRotorsBlock, setAccessibilityDecrementBlock, setAccessibilityDirectTouchOptions, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsBlock, setAccessibilityElementsHidden, setAccessibilityElementsHiddenBlock, setAccessibilityFrame, setAccessibilityFrameBlock, setAccessibilityHeaderElementsBlock, setAccessibilityHint, setAccessibilityHintBlock, setAccessibilityIdentifierBlock, setAccessibilityIncrementBlock, setAccessibilityLabel, setAccessibilityLabelBlock, setAccessibilityLanguage, setAccessibilityLanguageBlock, setAccessibilityMagicTapBlock, setAccessibilityNavigationStyle, setAccessibilityNavigationStyleBlock, setAccessibilityPath, setAccessibilityPathBlock, setAccessibilityPerformEscapeBlock, setAccessibilityRespondsToUserInteraction, setAccessibilityRespondsToUserInteractionBlock, setAccessibilityShouldGroupAccessibilityChildrenBlock, setAccessibilityTextualContext, setAccessibilityTextualContextBlock, setAccessibilityTraits, setAccessibilityTraitsBlock, setAccessibilityUserInputLabels, setAccessibilityUserInputLabelsBlock, setAccessibilityValue, setAccessibilityValueBlock, setAccessibilityViewIsModal, setAccessibilityViewIsModalBlock, setAutomationElements, setAutomationElementsBlock, setIsAccessibilityElement, setIsAccessibilityElementBlock, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, storedValueForKey, superclass, takeStoredValueForKey, takeValueForKey, takeValueForKeyPath, takeValuesFromDictionary, unableToSetNilForKey, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, valuesForKeys, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static NSURLSession alloc()
-
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()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
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.
-
sessionWithConfigurationDelegateDelegateQueue
@NotNull public static @NotNull NSURLSession sessionWithConfigurationDelegateDelegateQueue(@NotNull @NotNull NSURLSessionConfiguration configuration, @Nullable @Nullable NSURLSessionDelegate delegate, @Nullable @Nullable NSOperationQueue queue)
-
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()
-
configuration
@NotNull public @NotNull NSURLSessionConfiguration configuration()
-
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.
-
dataTaskWithURLCompletionHandler
@NotNull public @NotNull NSURLSessionDataTask dataTaskWithURLCompletionHandler(@NotNull @NotNull NSURL url, @NotNull @NotNull NSURLSession.Block_dataTaskWithURLCompletionHandler completionHandler)
-
delegate
@Nullable public @Nullable NSURLSessionDelegate delegate()
-
delegateQueue
@NotNull public @NotNull NSOperationQueue delegateQueue()
-
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.
-
downloadTaskWithResumeDataCompletionHandler
@NotNull public @NotNull NSURLSessionDownloadTask downloadTaskWithResumeDataCompletionHandler(@NotNull @NotNull NSData resumeData, @NotNull @NotNull NSURLSession.Block_downloadTaskWithResumeDataCompletionHandler completionHandler)
-
downloadTaskWithURL
@NotNull public @NotNull NSURLSessionDownloadTask downloadTaskWithURL(@NotNull @NotNull NSURL url)
Creates a download task to download the contents of the given URL.
-
downloadTaskWithURLCompletionHandler
@NotNull public @NotNull NSURLSessionDownloadTask downloadTaskWithURLCompletionHandler(@NotNull @NotNull NSURL url, @NotNull @NotNull NSURLSession.Block_downloadTaskWithURLCompletionHandler completionHandler)
-
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.
-
getAllTasksWithCompletionHandler
public void getAllTasksWithCompletionHandler(@NotNull @NotNull NSURLSession.Block_getAllTasksWithCompletionHandler completionHandler)invokes completionHandler with all outstanding tasks. API-Since: 9.0
-
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
-
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.
-
uploadTaskWithRequestFromDataCompletionHandler
@NotNull public @NotNull NSURLSessionUploadTask uploadTaskWithRequestFromDataCompletionHandler(@NotNull @NotNull NSURLRequest request, @Nullable @Nullable NSData bodyData, @NotNull @NotNull NSURLSession.Block_uploadTaskWithRequestFromDataCompletionHandler completionHandler)
-
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
-
uploadTaskWithRequestFromFileCompletionHandler
@NotNull public @NotNull NSURLSessionUploadTask uploadTaskWithRequestFromFileCompletionHandler(@NotNull @NotNull NSURLRequest request, @NotNull @NotNull NSURL fileURL, @NotNull @NotNull NSURLSession.Block_uploadTaskWithRequestFromFileCompletionHandler completionHandler)
upload convenience method.
-
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.
-
-