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
-
-
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_uploadTaskWithRequestFromFileCompletionHandler-
Nested classes/interfaces inherited from class apple.NSObject
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 Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static NSURLSessionalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()NSURLSessionConfigurationconfiguration()NSURLSessionDataTaskdataTaskWithRequest(NSURLRequest request)Creates a data task with the given request.NSURLSessionDataTaskdataTaskWithRequestCompletionHandler(NSURLRequest request, NSURLSession.Block_dataTaskWithRequestCompletionHandler completionHandler)data task convenience methods.NSURLSessionDataTaskdataTaskWithURL(NSURL url)Creates a data task to retrieve the contents of the given URL.NSURLSessionDataTaskdataTaskWithURLCompletionHandler(NSURL url, NSURLSession.Block_dataTaskWithURLCompletionHandler completionHandler)static java.lang.StringdebugDescription_static()NSURLSessionDelegatedelegate()NSOperationQueuedelegateQueue()static java.lang.Stringdescription_static()NSURLSessionDownloadTaskdownloadTaskWithRequest(NSURLRequest request)Creates a download task with the given request.NSURLSessionDownloadTaskdownloadTaskWithRequestCompletionHandler(NSURLRequest request, NSURLSession.Block_downloadTaskWithRequestCompletionHandler completionHandler)download task convenience methods.NSURLSessionDownloadTaskdownloadTaskWithResumeData(NSData resumeData)Creates a download task with the resume data.NSURLSessionDownloadTaskdownloadTaskWithResumeDataCompletionHandler(NSData resumeData, NSURLSession.Block_downloadTaskWithResumeDataCompletionHandler completionHandler)NSURLSessionDownloadTaskdownloadTaskWithURL(NSURL url)Creates a download task to download the contents of the given URL.NSURLSessionDownloadTaskdownloadTaskWithURLCompletionHandler(NSURL url, NSURLSession.Block_downloadTaskWithURLCompletionHandler completionHandler)voidfinishTasksAndInvalidate()-finishTasksAndInvalidate returns immediately and existing tasks will be allowed to run to completion.voidflushWithCompletionHandler(NSURLSession.Block_flushWithCompletionHandler completionHandler)flush storage to disk and clear transient network caches.voidgetAllTasksWithCompletionHandler(NSURLSession.Block_getAllTasksWithCompletionHandler completionHandler)invokes completionHandler with all outstanding tasks.voidgetTasksWithCompletionHandler(NSURLSession.Block_getTasksWithCompletionHandler completionHandler)invokes completionHandler with outstanding data, upload and download tasks.static longhash_static()NSURLSessioninit()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 NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)static java.lang.Objectnew_objc()voidresetWithCompletionHandler(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)java.lang.StringsessionDescription()The sessionDescription property is available for the developer to provide a descriptive label for the session.static NSURLSessionsessionWithConfiguration(NSURLSessionConfiguration configuration)Customization of NSURLSession occurs during creation of a new session.static NSURLSessionsessionWithConfigurationDelegateDelegateQueue(NSURLSessionConfiguration configuration, NSURLSessionDelegate delegate, NSOperationQueue queue)voidsetSessionDescription(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 NSURLSessionsharedSession()The shared session uses the currently set global NSURLCache, NSHTTPCookieStorage and NSURLCredentialStorage objects.NSURLSessionStreamTaskstreamTaskWithHostNamePort(java.lang.String hostname, long port)Creates a bidirectional stream task to a given host and port.NSURLSessionStreamTaskstreamTaskWithNetService(NSNetService service)Creates a bidirectional stream task with an NSNetService to identify the endpoint.static org.moe.natj.objc.Classsuperclass_static()NSURLSessionUploadTaskuploadTaskWithRequestFromData(NSURLRequest request, NSData bodyData)Creates an upload task with the given request.NSURLSessionUploadTaskuploadTaskWithRequestFromDataCompletionHandler(NSURLRequest request, NSData bodyData, NSURLSession.Block_uploadTaskWithRequestFromDataCompletionHandler completionHandler)NSURLSessionUploadTaskuploadTaskWithRequestFromFile(NSURLRequest request, NSURL fileURL)Creates an upload task with the given request.NSURLSessionUploadTaskuploadTaskWithRequestFromFileCompletionHandler(NSURLRequest request, NSURL fileURL, NSURLSession.Block_uploadTaskWithRequestFromFileCompletionHandler completionHandler)upload convenience method.NSURLSessionUploadTaskuploadTaskWithStreamedRequest(NSURLRequest request)Creates an upload task with the given request.static longversion_static()NSURLSessionWebSocketTaskwebSocketTaskWithRequest(NSURLRequest request)Creates a WebSocket task given the request.NSURLSessionWebSocketTaskwebSocketTaskWithURL(NSURL url)Creates a WebSocket task given the url.NSURLSessionWebSocketTaskwebSocketTaskWithURLProtocols(NSURL url, NSArray<java.lang.String> protocols)Creates a WebSocket task given the url and an array of protocols.-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, 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, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static NSURLSession alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
public static 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
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
-
new_objc
public static java.lang.Object new_objc()
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
sessionWithConfiguration
public static NSURLSession sessionWithConfiguration(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
public static NSURLSession sessionWithConfigurationDelegateDelegateQueue(NSURLSessionConfiguration configuration, NSURLSessionDelegate delegate, NSOperationQueue queue)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
sharedSession
public static 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
public NSURLSessionConfiguration configuration()
-
dataTaskWithRequest
public NSURLSessionDataTask dataTaskWithRequest(NSURLRequest request)
Creates a data task with the given request. The request may have a body stream.
-
dataTaskWithRequestCompletionHandler
public NSURLSessionDataTask dataTaskWithRequestCompletionHandler(NSURLRequest request, 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
public NSURLSessionDataTask dataTaskWithURL(NSURL url)
Creates a data task to retrieve the contents of the given URL.
-
dataTaskWithURLCompletionHandler
public NSURLSessionDataTask dataTaskWithURLCompletionHandler(NSURL url, NSURLSession.Block_dataTaskWithURLCompletionHandler completionHandler)
-
delegate
public NSURLSessionDelegate delegate()
-
delegateQueue
public NSOperationQueue delegateQueue()
-
downloadTaskWithRequest
public NSURLSessionDownloadTask downloadTaskWithRequest(NSURLRequest request)
Creates a download task with the given request.
-
downloadTaskWithRequestCompletionHandler
public NSURLSessionDownloadTask downloadTaskWithRequestCompletionHandler(NSURLRequest request, 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
public NSURLSessionDownloadTask downloadTaskWithResumeData(NSData resumeData)
Creates a download task with the resume data. If the download cannot be successfully resumed, URLSession:task:didCompleteWithError: will be called.
-
downloadTaskWithResumeDataCompletionHandler
public NSURLSessionDownloadTask downloadTaskWithResumeDataCompletionHandler(NSData resumeData, NSURLSession.Block_downloadTaskWithResumeDataCompletionHandler completionHandler)
-
downloadTaskWithURL
public NSURLSessionDownloadTask downloadTaskWithURL(NSURL url)
Creates a download task to download the contents of the given URL.
-
downloadTaskWithURLCompletionHandler
public NSURLSessionDownloadTask downloadTaskWithURLCompletionHandler(NSURL url, 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(NSURLSession.Block_flushWithCompletionHandler completionHandler)
flush storage to disk and clear transient network caches. Invokes completionHandler() on the delegate queue if not nil.
-
getAllTasksWithCompletionHandler
public void getAllTasksWithCompletionHandler(NSURLSession.Block_getAllTasksWithCompletionHandler completionHandler)
invokes completionHandler with all outstanding tasks.
-
getTasksWithCompletionHandler
public void getTasksWithCompletionHandler(NSURLSession.Block_getTasksWithCompletionHandler completionHandler)
invokes completionHandler with outstanding data, upload and download tasks.
-
init
public NSURLSession init()
-
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(NSURLSession.Block_resetWithCompletionHandler completionHandler)
empty all cookies, cache and credential stores, removes disk files, issues -flushWithCompletionHandler:. Invokes completionHandler() on the delegate queue if not nil.
-
sessionDescription
public java.lang.String sessionDescription()
The sessionDescription property is available for the developer to provide a descriptive label for the session.
-
setSessionDescription
public void setSessionDescription(java.lang.String value)
The sessionDescription property is available for the developer to provide a descriptive label for the session.
-
streamTaskWithHostNamePort
public NSURLSessionStreamTask streamTaskWithHostNamePort(java.lang.String hostname, long port)
Creates a bidirectional stream task to a given host and port.
-
streamTaskWithNetService
public NSURLSessionStreamTask streamTaskWithNetService(NSNetService service)
Creates a bidirectional stream task with an NSNetService to identify the endpoint. The NSNetService will be resolved before any IO completes.
-
uploadTaskWithRequestFromData
public NSURLSessionUploadTask uploadTaskWithRequestFromData(NSURLRequest request, NSData bodyData)
Creates an upload task with the given request. The body of the request is provided from the bodyData.
-
uploadTaskWithRequestFromDataCompletionHandler
public NSURLSessionUploadTask uploadTaskWithRequestFromDataCompletionHandler(NSURLRequest request, NSData bodyData, NSURLSession.Block_uploadTaskWithRequestFromDataCompletionHandler completionHandler)
-
uploadTaskWithRequestFromFile
public NSURLSessionUploadTask uploadTaskWithRequestFromFile(NSURLRequest request, 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
public NSURLSessionUploadTask uploadTaskWithRequestFromFileCompletionHandler(NSURLRequest request, NSURL fileURL, NSURLSession.Block_uploadTaskWithRequestFromFileCompletionHandler completionHandler)
upload convenience method.
-
uploadTaskWithStreamedRequest
public NSURLSessionUploadTask uploadTaskWithStreamedRequest(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
public NSURLSessionWebSocketTask webSocketTaskWithRequest(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.
-
webSocketTaskWithURL
public NSURLSessionWebSocketTask webSocketTaskWithURL(NSURL url)
Creates a WebSocket task given the url. The given url must have a ws or wss scheme.
-
webSocketTaskWithURLProtocols
public NSURLSessionWebSocketTask webSocketTaskWithURLProtocols(NSURL url, 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 prefered 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
-
-