Class NSItemProvider

  • All Implemented Interfaces:
    NSCopying, NSObject

    public class NSItemProvider
    extends NSObject
    implements NSCopying
    An NSItemProvider is a high level abstraction for an item supporting multiple representations. API-Since: 8.0
    • Constructor Detail

      • NSItemProvider

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

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static NSItemProvider 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)
      • 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()
      • copyWithZone

        @NotNull
        public @NotNull java.lang.Object copyWithZone​(@Nullable
                                                      @Nullable org.moe.natj.general.ptr.VoidPtr zone)
        Specified by:
        copyWithZone in interface NSCopying
      • hasItemConformingToTypeIdentifier

        public boolean hasItemConformingToTypeIdentifier​(@NotNull
                                                         @NotNull java.lang.String typeIdentifier)
        Returns YES if the item provider has at least one item that conforms to the supplied type identifier.
      • initWithContentsOfURL

        public NSItemProvider initWithContentsOfURL​(NSURL fileURL)
        Initialize an NSItemProvider with load handlers for the given file URL, and the file content. A type identifier is inferred from the file extension.
      • initWithItemTypeIdentifier

        public NSItemProvider initWithItemTypeIdentifier​(@Nullable
                                                         @Nullable NSSecureCoding item,
                                                         @Nullable
                                                         @Nullable java.lang.String typeIdentifier)
        Initialize an NSItemProvider with an object assigned to a single UTI. `item` is retained.
      • loadItemForTypeIdentifierOptionsCompletionHandler

        public void loadItemForTypeIdentifierOptionsCompletionHandler​(@NotNull
                                                                      @NotNull java.lang.String typeIdentifier,
                                                                      @Nullable
                                                                      @Nullable NSDictionary<?,​?> options,
                                                                      @Nullable
                                                                      @Nullable NSItemProvider.Block_loadItemForTypeIdentifierOptionsCompletionHandler completionHandler)
        Loads the best matching item for a type identifier. The returned object depends on the class specified for the completion handler's `item` parameter. See the table above for coercion rules.
      • loadPreviewImageWithOptionsCompletionHandler

        public void loadPreviewImageWithOptionsCompletionHandler​(NSDictionary<?,​?> options,
                                                                 NSItemProvider.Block_loadPreviewImageWithOptionsCompletionHandler completionHandler)
        Loads the preview image for this item by either calling the supplied preview block or falling back to a QuickLook-based handler. This method, like loadItemForTypeIdentifier:options:completionHandler:, supports implicit type coercion for the item parameter of the completion block. Allowed value classes are: NSData, NSURL, UIImage/NSImage. API-Since: 8.0
      • registeredTypeIdentifiers

        @NotNull
        public @NotNull NSArray<java.lang.String> registeredTypeIdentifiers()
        Returns the list of registered type identifiers, in the order they were registered.
      • canLoadObjectOfClass

        public boolean canLoadObjectOfClass​(@NotNull
                                            @NotNull NSItemProviderReading aClass)
        API-Since: 11.0
      • hasRepresentationConformingToTypeIdentifierFileOptions

        public boolean hasRepresentationConformingToTypeIdentifierFileOptions​(@NotNull
                                                                              @NotNull java.lang.String typeIdentifier,
                                                                              long fileOptions)
        API-Since: 11.0
      • initWithObject

        public NSItemProvider initWithObject​(@NotNull
                                             @NotNull NSItemProviderWriting object)
        Instantiate an NSItemProvider by querying an object for its eligible type identifiers via the NSItemProviderWriting protocol. API-Since: 11.0
      • loadFileRepresentationForTypeIdentifierCompletionHandler

        @NotNull
        public @NotNull NSProgress loadFileRepresentationForTypeIdentifierCompletionHandler​(@NotNull
                                                                                            @NotNull java.lang.String typeIdentifier,
                                                                                            @NotNull
                                                                                            @NotNull NSItemProvider.Block_loadFileRepresentationForTypeIdentifierCompletionHandler completionHandler)
        Writes a copy of the data to a temporary file. This file will be deleted when the completion handler returns. Your program should copy or move the file within the completion handler. API-Since: 11.0
      • loadInPlaceFileRepresentationForTypeIdentifierCompletionHandler

        @NotNull
        public @NotNull NSProgress loadInPlaceFileRepresentationForTypeIdentifierCompletionHandler​(@NotNull
                                                                                                   @NotNull java.lang.String typeIdentifier,
                                                                                                   @NotNull
                                                                                                   @NotNull NSItemProvider.Block_loadInPlaceFileRepresentationForTypeIdentifierCompletionHandler completionHandler)
        Open the original file in place, if possible. If a file is not available for opening in place, a copy of the file is written to a temporary location, and `isInPlace` is set to NO. Your program may then copy or move the file, or the system will delete this file at some point in the future. API-Since: 11.0
      • preferredPresentationSize

        public CGSize preferredPresentationSize()
        Estimated presentation size, in points. CGSizeZero value indicates this information is not available. API-Since: 11.0
      • preferredPresentationStyle

        public long preferredPresentationStyle()
        API-Since: 11.0
      • registerObjectVisibility

        public void registerObjectVisibility​(@NotNull
                                             @NotNull NSItemProviderWriting object,
                                             long visibility)
        Add representations from an object using the NSItemProviderWriting protocol. Duplicate representations are ignored. API-Since: 11.0
      • registeredTypeIdentifiersWithFileOptions

        @NotNull
        public @NotNull NSArray<java.lang.String> registeredTypeIdentifiersWithFileOptions​(long fileOptions)
        API-Since: 11.0
      • setPreferredPresentationSize

        public void setPreferredPresentationSize​(CGSize value)
        Estimated presentation size, in points. CGSizeZero value indicates this information is not available. API-Since: 11.0
      • setPreferredPresentationStyle

        public void setPreferredPresentationStyle​(long value)
        API-Since: 11.0
      • setSuggestedName

        public void setSuggestedName​(@Nullable
                                     @Nullable java.lang.String value)
        API-Since: 11.0
      • setTeamData

        public void setTeamData​(@Nullable
                                @Nullable NSData value)
        API-Since: 11.0
      • suggestedName

        @Nullable
        public @Nullable java.lang.String suggestedName()
        API-Since: 11.0
      • teamData

        @Nullable
        public @Nullable NSData teamData()
        API-Since: 11.0
      • previewImageHandler

        @Nullable
        public @Nullable NSItemProvider.Block_previewImageHandler_ret previewImageHandler()
        Sets a custom preview image handler block for this item provider. The returned item should preferably be NSData or a file NSURL. API-Since: 8.0
      • registerFileRepresentationForTypeIdentifierFileOptionsVisibilityLoadHandler

        public void registerFileRepresentationForTypeIdentifierFileOptionsVisibilityLoadHandler​(@NotNull
                                                                                                @NotNull java.lang.String typeIdentifier,
                                                                                                long fileOptions,
                                                                                                long visibility,
                                                                                                @NotNull
                                                                                                @NotNull NSItemProvider.Block_registerFileRepresentationForTypeIdentifierFileOptionsVisibilityLoadHandler loadHandler)
        Registers a file-backed representation. Set `coordinated` to YES if the returned file must be accessed using NSFileCoordinator. If `NSItemProviderFileOptionOpenInPlace` is not provided, the file provided will be copied before the load handler returns. API-Since: 11.0
      • registerItemForTypeIdentifierLoadHandler

        public void registerItemForTypeIdentifierLoadHandler​(@NotNull
                                                             @NotNull java.lang.String typeIdentifier,
                                                             @NotNull
                                                             @NotNull NSItemProvider.Block_registerItemForTypeIdentifierLoadHandler loadHandler)
        Registers a load handler that returns an object, assigned to a single UTI.
      • setPreviewImageHandler

        public void setPreviewImageHandler​(@Nullable
                                           @Nullable NSItemProvider.Block_setPreviewImageHandler value)
        Sets a custom preview image handler block for this item provider. The returned item should preferably be NSData or a file NSURL. API-Since: 8.0
      • initWithContentsOfURLContentTypeOpenInPlaceCoordinatedVisibility

        public NSItemProvider initWithContentsOfURLContentTypeOpenInPlaceCoordinatedVisibility​(@NotNull
                                                                                               @NotNull NSURL fileURL,
                                                                                               @Nullable
                                                                                               @Nullable UTType contentType,
                                                                                               boolean openInPlace,
                                                                                               boolean coordinated,
                                                                                               long visibility)
        Initialize this instance with the contents of a URL \discussion The filename of the URL is copied into the \c suggestedName property \param fileURL The URL of the file. \param contentType The content type associated with this file, or \c nil to deduce the content type from the file extension. \param openInPlace Pass \c YES to allow this file to be opened in place. \param coordinated Pass \c YES to use file coordination to access this file, even if it is not opened in place. If \c openInPlace is set to \c YES file coordination will be used and this parameter is ignored. \param visibility The visibility of this representation. API-Since: 16.0
      • loadDataRepresentationForContentTypeCompletionHandler

        @NotNull
        public @NotNull NSProgress loadDataRepresentationForContentTypeCompletionHandler​(@NotNull
                                                                                         @NotNull UTType contentType,
                                                                                         @NotNull
                                                                                         @NotNull NSItemProvider.Block_loadDataRepresentationForContentTypeCompletionHandler completionHandler)
        Load a representation as data \discussion If the requested representation was registered as a file, an \c NSData with the contents of the file will be provided. If the registered URL points to a folder, an \c NSData containing a zip archive containing that folder will be provided. \note The completion handler may be scheduled on an arbitrary queue. \param contentType Content type of the representation to load. Must conform to one of the content types returned by \c registeredContentTypes \param completionHandler A block that will be called when loading is complete. It will either have a non-nil \c data or a non-nil \c error parameter. \return A progress object. Use it to monitor loading progress, or to cancel loading. API-Since: 16.0
      • loadFileRepresentationForContentTypeOpenInPlaceCompletionHandler

        @NotNull
        public @NotNull NSProgress loadFileRepresentationForContentTypeOpenInPlaceCompletionHandler​(@NotNull
                                                                                                    @NotNull UTType contentType,
                                                                                                    boolean openInPlace,
                                                                                                    @NotNull
                                                                                                    @NotNull NSItemProvider.Block_loadFileRepresentationForContentTypeOpenInPlaceCompletionHandler completionHandler)
        Load a representation as a file \discussion Except for files registered as open-in-place, a temporary file containing a copy of the original will be provided to your completion handler. This temporary file will be deleted once your completion handler returns. To keep a copy of this file, move or copy it into another directory before returning from the completion handler. \discussion If the representation was registered as \c NSData its contents will be written to a temporary file. \discussion If \c suggestedName is non-nil, an attempt will be made to use it as the file name, with an appropriate file extension based on the content type. Otherwise, a suitable name and file extension will be chosen based on the content type. \note The completion handler may be scheduled on an arbitrary queue \param contentType Content type of the representation to load. Must conform to one of the content types returned by \c registeredContentTypes \param openInPlace Pass \c YES to attempt to open a file representation in place \param completionHandler A block that will be called when loading is complete. It will either have a non-nil \c URL or a non-nill \c error parameter. The \c openInPlace parameter will be set to \c YES if the file was successfully opened in place, or \c NO if a copy of the file was created in a temporary directory. \return A progress object. Use it to monitor loading progress, or to cancel loading. API-Since: 16.0
      • registerCKShareContainerAllowedSharingOptions

        public void registerCKShareContainerAllowedSharingOptions​(@NotNull
                                                                  @NotNull CKShare share,
                                                                  @NotNull
                                                                  @NotNull CKContainer container,
                                                                  @NotNull
                                                                  @NotNull CKAllowedSharingOptions allowedOptions)
        Use this method when you have a @c CKShare that is already saved to the server. Invoking the share sheet with a @c CKShare registered with this method will allow the owner to make modifications to the share settings, or will allow a participant to view the share settings. API-Since: 16.0
      • registerCKShareWithContainerAllowedSharingOptionsPreparationHandler

        public void registerCKShareWithContainerAllowedSharingOptionsPreparationHandler​(@NotNull
                                                                                        @NotNull CKContainer container,
                                                                                        @NotNull
                                                                                        @NotNull CKAllowedSharingOptions allowedOptions,
                                                                                        @NotNull
                                                                                        @NotNull NSItemProvider.Block_registerCKShareWithContainerAllowedSharingOptionsPreparationHandler preparationHandler)
        Use this method when you want to share a collection of @c CKRecords but don't currently have a @c CKShare. When the @c preparationHandler is called, you should create a new @c CKShare with the appropriate root @c CKRecord or @c CKRecordZoneID. After ensuring the share and all records have been saved to the server, invoke the @c preparationCompletionHandler with either the resulting @c CKShare, or an @c NSError if saving failed. Invoking the share sheet with a @c CKShare registered with this method will prompt the user to start sharing. API-Since: 16.0
      • registerDataRepresentationForContentTypeVisibilityLoadHandler

        public void registerDataRepresentationForContentTypeVisibilityLoadHandler​(@NotNull
                                                                                  @NotNull UTType contentType,
                                                                                  long visibility,
                                                                                  @NotNull
                                                                                  @NotNull NSItemProvider.Block_registerDataRepresentationForContentTypeVisibilityLoadHandler loadHandler)
        Register a representation backed by an \c NSData \discussion The load handler must call the completion block when loading is complete. Pass either a non-nil data object, or a non-nil error. If the load handler returns a non-nil progress object, it should report loading progress and respond to cancelation. \param contentType The content type associated with the data representation. \param visibility Specifies which processes have access to this representation. \param loadHandler A block called to provide the data representation. API-Since: 16.0
      • registerFileRepresentationForContentTypeVisibilityOpenInPlaceLoadHandler

        public void registerFileRepresentationForContentTypeVisibilityOpenInPlaceLoadHandler​(@NotNull
                                                                                             @NotNull UTType contentType,
                                                                                             long visibility,
                                                                                             boolean openInPlace,
                                                                                             @NotNull
                                                                                             @NotNull NSItemProvider.Block_registerFileRepresentationForContentTypeVisibilityOpenInPlaceLoadHandler loadHandler)
        Register a representation backed by a file \discussion It is permissible to provide a URL pointing to a folder. A folder requested as \c NSData will yield a data object containing a zip archive holding a copy of the source folder tree. The load handler must call the completion block when loading is complete. Pass either a non-nil url, or a non-nil error. Pass \c YES to \c coordinated if the file should be accessed using file coordination even if it is not opened in-place. Files registered as open-in-place are assumed to need coordination, and this parameter will be ignored in those cases. If the load handler returns a non-nil progress object, it should report loading progress and respond to cancelation. \note Not all files specified as openable in place can be opened in place by the destination. System security or privacy policies may restrict which files can be opened in place. \param contentType The content type associated with the file representation. \param visibility Specifies which processes have access to this representation. \param openInPlace Specifies whether the file should be openable in place. \param loadHandler A block called to provide the file representation. API-Since: 16.0
      • registeredContentTypes

        @NotNull
        public @NotNull NSArray<? extends UTType> registeredContentTypes()
        Registered content types, in the order they were registered \discussion Content types should be registered in order of fidelity. Prefer using content types that appear earlier in the array. API-Since: 16.0
      • registeredContentTypesConformingToContentType

        @NotNull
        public @NotNull NSArray<? extends UTType> registeredContentTypesConformingToContentType​(@NotNull
                                                                                                @NotNull UTType contentType)
        Return an array of registered content types that conform to a given content type. \discussion The returned content types are given in order of fidelity. Prefer content types that appear earlier in the array. API-Since: 16.0
      • registeredContentTypesForOpenInPlace

        @NotNull
        public @NotNull NSArray<? extends UTType> registeredContentTypesForOpenInPlace()
        Registered content types that can be loaded as files opened in place API-Since: 16.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.