Package apple.networkextension
Class NWTCPConnection
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.networkextension.NWTCPConnection
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNWTCPConnection.Block_readLengthCompletionHandlerstatic interfaceNWTCPConnection.Block_readMinimumLengthMaximumLengthCompletionHandlerstatic interfaceNWTCPConnection.Block_writeCompletionHandler-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNWTCPConnection(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static NWTCPConnectionalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)voidcancel()cancel: Cancel the connection.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()NWPathconnectedPath()[@property] connectedPath The network path over which the connection was established.static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()NWEndpointendpoint()[@property] endpoint The destination endpoint with which this connection was created.NSErrorerror()[@property] error The connection-wide error property indicates any fatal error that occurred while processing the connection or performing data reading or writing.booleanhasBetterPath()[@property] hasBetterPath YES if the system determines there is a better path the destination can be reached if the caller creates a new connection using the same endpoint and parameters.static longhash_static()NWTCPConnectioninit()NWTCPConnectioninitWithUpgradeForConnection(NWTCPConnection connection)initWithUpgradeForConnection: This convenience initializer can be used to create a new connection that would only be connected if there exists a better path (as determined by the system) to the destination endpoint of the original connection.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)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)booleanisViable()[@property] viable YES if the connection can read and write data, NO otherwise.static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)NWEndpointlocalAddress()[@property] localAddress The IP address endpoint from which the connection was connected.static java.lang.Objectnew_objc()voidreadLengthCompletionHandler(long length, NWTCPConnection.Block_readLengthCompletionHandler completion)readLength:completionHandler: Read "length" number of bytes.voidreadMinimumLengthMaximumLengthCompletionHandler(long minimum, long maximum, NWTCPConnection.Block_readMinimumLengthMaximumLengthCompletionHandler completion)readMinimumLength:maximumLength:completionHandler: Read the requested range of bytes.NWEndpointremoteAddress()[@property] remoteAddress The IP address endpoint to which the connection was connected.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)static voidsetVersion_static(long aVersion)longstate()[@property] state The status of the connection.static org.moe.natj.objc.Classsuperclass_static()NSDatatxtRecord()[@property] txtRecord When the connection is connected to a Bonjour service endpoint, the TXT record associated with the Bonjour service is available via this property.static longversion_static()voidwriteClose()writeClose: Close this connection's write side such that further write requests won't succeed.voidwriteCompletionHandler(NSData data, NWTCPConnection.Block_writeCompletionHandler completion)write:completionHandler: Write the given data object content.-
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 NWTCPConnection 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)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
version_static
public static long version_static()
-
cancel
public void cancel()
cancel: Cancel the connection. This will clean up the resources associated with this object and transition this object to NWTCPConnectionStateCancelled state.
-
connectedPath
public NWPath connectedPath()
[@property] connectedPath The network path over which the connection was established. The caller can query additional properties from the NWPath object for more information. Note that this contains a snapshot of information at the time of connection establishment for this connection only. As a result, some underlying properties might change in time and might not reflect the path for other connections that might be established at different times.
-
endpoint
public NWEndpoint endpoint()
[@property] endpoint The destination endpoint with which this connection was created.
-
error
public NSError error()
[@property] error The connection-wide error property indicates any fatal error that occurred while processing the connection or performing data reading or writing.
-
hasBetterPath
public boolean hasBetterPath()
[@property] hasBetterPath YES if the system determines there is a better path the destination can be reached if the caller creates a new connection using the same endpoint and parameters. This can be done using the convenience upgrade initializer method. Use KVO to watch this property to get updates.
-
init
public NWTCPConnection init()
-
initWithUpgradeForConnection
public NWTCPConnection initWithUpgradeForConnection(NWTCPConnection connection)
initWithUpgradeForConnection: This convenience initializer can be used to create a new connection that would only be connected if there exists a better path (as determined by the system) to the destination endpoint of the original connection. It will be initialized using the same destination endpoint and set of parameters from the original connection. If the original connection becomes disconnected or cancelled, the new "upgrade" connection would automatically be considered better. The caller should create an NWTCPConnection and watch for the hasBetterPath property. When this property is YES, the caller should attempt to create a new upgrade connection, with the goal to start transferring data on the new better path as soon as possible to reduce power and potentially monetary cost. When the new upgrade connection becomes connected and when the caller wraps up the previous caller session on the original connection, the caller can start using the new upgrade connection and tear down the original one.- Parameters:
connection- The original connection from which the caller will upgrade- Returns:
- An initialized NWTCPConnection
-
isViable
public boolean isViable()
[@property] viable YES if the connection can read and write data, NO otherwise. Use KVO to watch this property.
-
localAddress
public NWEndpoint localAddress()
[@property] localAddress The IP address endpoint from which the connection was connected.
-
readLengthCompletionHandler
public void readLengthCompletionHandler(long length, NWTCPConnection.Block_readLengthCompletionHandler completion)readLength:completionHandler: Read "length" number of bytes. See readMinimumLength:maximumLength:completionHandler: for a complete discussion of the callback behavior.- Parameters:
length- The exact number of bytes the application wants to readcompletion- The completion handler to be invoked when there is data to read or an error occurred
-
readMinimumLengthMaximumLengthCompletionHandler
public void readMinimumLengthMaximumLengthCompletionHandler(long minimum, long maximum, NWTCPConnection.Block_readMinimumLengthMaximumLengthCompletionHandler completion)readMinimumLength:maximumLength:completionHandler: Read the requested range of bytes. The completion handler will be invoked when: - Exactly "length" number of bytes have been read. 'data' will be non-nil. - Fewer than "length" number of bytes, including 0 bytes, have been read, and the connection's read side has been closed. 'data' might be nil, depending on whether there was any data to be read when the connection's read side was closed. - Some fatal error has occurred, and 'data' will be nil. To know when to schedule a read again, check for the condition whether an error has occurred. For better performance, the caller should pick the effective minimum and maximum lengths. For example, if the caller absolutely needs a specific number of bytes before it can make any progress, use that value as the minimum. The maximum bytes can be the upperbound that the caller wants to read. Typically, the minimum length can be the caller protocol fixed-size header and the maximum length can be the maximum size of the payload or the size of the current read buffer.- Parameters:
minimum- The minimum number of bytes the caller wants to readmaximum- The maximum number of bytes the caller wants to readcompletion- The completion handler to be invoked when there is data to read or an error occurred
-
remoteAddress
public NWEndpoint remoteAddress()
[@property] remoteAddress The IP address endpoint to which the connection was connected.
-
state
public long state()
[@property] state The status of the connection. Use KVO to watch this property to get updates.
-
txtRecord
public NSData txtRecord()
[@property] txtRecord When the connection is connected to a Bonjour service endpoint, the TXT record associated with the Bonjour service is available via this property. Beware that the value comes from the network. Care must be taken when parsing this potentially malicious value.
-
writeCompletionHandler
public void writeCompletionHandler(NSData data, NWTCPConnection.Block_writeCompletionHandler completion)
write:completionHandler: Write the given data object content. Callers should wait until the completionHandler is executed before issuing another write.- Parameters:
data- The data object whose content will be writtencompletion- The completion handler to be invoked when the data content has been written or an error has occurred. If the error is nil, the write succeeded and the caller can write more data.
-
writeClose
public void writeClose()
writeClose: Close this connection's write side such that further write requests won't succeed. Note that this has the effect of closing the read side of the peer connection. When the connection's read side and write side are closed, the connection is considered disconnected and will transition to the appropriate state.
-
-