APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.glass.ui.mac

public final Class MacFileNSURL

extends File
Class Inheritance
Imports
com.sun.glass.ui.Application, java.io.File

A descendant of the File class that also provides access to the underlying native NSURL object associated with this File instance. Objects of this type are returned as a result of invoking the CommonDialogs.show[File|Folder]Chooser() methods if the "glass.macosx.enableFileNSURL" system property is true.

Field Summary

Modifier and TypeField and Description
private long
ptr

A pointer to the NSURL object.

Inherited from java.io.File:
pathSeparatorpathSeparatorCharseparatorseparatorChar

Constructor Summary

AccessConstructor and Description
private
MacFileNSURL(String name, long ptr)

Method Summary

Modifier and TypeMethod and Description
private static native MacFileNSURL
_createFromBookmark(byte[] data, long baseDocumentPtr)

private native void
_dispose(long ptr)

private native byte[]
_getBookmark(long ptr, long baseDocumentPtr)

private static native void
private native boolean
private native void
private void
public static MacFileNSURL

Returns:

a new instance of MacFileNSURL
createFromBookmark
(byte[] data)

Returns an instance of the MacFileNSURL class created from bookmark data stored in the byte array passed as an argument.

public static MacFileNSURL

Returns:

a new instance of MacFileNSURL
createFromDocumentScopedBookmark
(byte[] data, MacFileNSURL baseDocument)

Returns an instance of the MacFileNSURL class created from a document-scoped bookmark data stored in the byte array passed as an argument, relative to the baseDocument URL.

public void
dispose()

Releases the underlying NSURL object.

public byte[]

Returns:

bookmark data in a form of byte[]
getBookmark
()

Returns a byte array representing a persistent bookmark for this URL.

public byte[]

Returns:

bookmark data in a form of byte[]
getDocumentScopedBookmark
(MacFileNSURL baseDocument)

Returns a byte array representing a document-scoped bookmark for this URL relative to the baseDocument URL.

public boolean

Returns:

true if the request to access the resource succeeded; otherwise, false
startAccessingSecurityScopedResource
()

Makes the resource pointed to by a security-scoped URL available to the app.

public void
stopAccessingSecurityScopedResource()

Revokes access to the resource pointed to by a security-scoped URL.

Inherited from java.io.File:
canExecutecanReadcanWritecompareTocreateNewFilecreateTempFilecreateTempFiledeletedeleteOnExitequalsexistsgetAbsoluteFilegetAbsolutePathgetCanonicalFilegetCanonicalPathgetFreeSpacegetNamegetParentgetParentFilegetPathgetTotalSpacegetUsableSpacehashCodeisAbsoluteisDirectoryisFileisHiddenlastModifiedlengthlistlistlistFileslistFileslistFileslistRootsmkdirmkdirsrenameTosetExecutablesetExecutablesetLastModifiedsetReadablesetReadablesetReadOnlysetWritablesetWritabletoPathtoStringtoURItoURL

Field Detail

ptrback to summary
private long ptr

A pointer to the NSURL object.

Constructor Detail

MacFileNSURLback to summary
private MacFileNSURL(String name, long ptr)

Method Detail

_createFromBookmarkback to summary
private static native MacFileNSURL _createFromBookmark(byte[] data, long baseDocumentPtr)
_disposeback to summary
private native void _dispose(long ptr)
_getBookmarkback to summary
private native byte[] _getBookmark(long ptr, long baseDocumentPtr)
_initIDsback to summary
private static native void _initIDs()
_startAccessingSecurityScopedResourceback to summary
private native boolean _startAccessingSecurityScopedResource(long ptr)
_stopAccessingSecurityScopedResourceback to summary
private native void _stopAccessingSecurityScopedResource(long ptr)
checkNotDisposedback to summary
private void checkNotDisposed()
createFromBookmarkback to summary
public static MacFileNSURL createFromBookmark(byte[] data)

Returns an instance of the MacFileNSURL class created from bookmark data stored in the byte array passed as an argument. The glass.macosx.enableFileNSURL system property must be set to true before calling this method.

Returns:MacFileNSURL

a new instance of MacFileNSURL

createFromDocumentScopedBookmarkback to summary
public static MacFileNSURL createFromDocumentScopedBookmark(byte[] data, MacFileNSURL baseDocument)

Returns an instance of the MacFileNSURL class created from a document-scoped bookmark data stored in the byte array passed as an argument, relative to the baseDocument URL. The glass.macosx.enableFileNSURL system property must be set to true before calling this method.

Returns:MacFileNSURL

a new instance of MacFileNSURL

Exceptions
NullPointerException:
if baseDocument is null
disposeback to summary
public void dispose()

Releases the underlying NSURL object. An application must call this method after it no longer needs to use this object in order to release native resources associated with it.

getBookmarkback to summary
public byte[] getBookmark()

Returns a byte array representing a persistent bookmark for this URL. An app can store this data, and later re-create the URL with a call to createFromBookmark.

Returns:byte[]

bookmark data in a form of byte[]

getDocumentScopedBookmarkback to summary
public byte[] getDocumentScopedBookmark(MacFileNSURL baseDocument)

Returns a byte array representing a document-scoped bookmark for this URL relative to the baseDocument URL. An app can store this data, and later re-create the URL with a call to createFromDocumentScopedBookmark.

Returns:byte[]

bookmark data in a form of byte[]

Exceptions
NullPointerException:
if baseDocument is null
startAccessingSecurityScopedResourceback to summary
public boolean startAccessingSecurityScopedResource()

Makes the resource pointed to by a security-scoped URL available to the app. The call must be balanced with a corresponding call to stopAccessingSecurityScopedResource using the try{}finally{} pattern.

Returns:boolean

true if the request to access the resource succeeded; otherwise, false

stopAccessingSecurityScopedResourceback to summary
public void stopAccessingSecurityScopedResource()

Revokes access to the resource pointed to by a security-scoped URL.