public final class MacFileNSURL extends File
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
.pathSeparator, pathSeparatorChar, separator, separatorChar
Modifier and Type | Method and Description |
---|---|
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.
|
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. |
void |
dispose()
Releases the underlying NSURL object.
|
byte[] |
getBookmark()
Returns a byte array representing a persistent bookmark for this URL.
|
byte[] |
getDocumentScopedBookmark(MacFileNSURL baseDocument)
Returns a byte array representing a document-scoped bookmark
for this URL relative to the
baseDocument URL. |
boolean |
startAccessingSecurityScopedResource()
Makes the resource pointed to by a security-scoped URL available to the app.
|
void |
stopAccessingSecurityScopedResource()
Revokes access to the resource pointed to by a security-scoped URL.
|
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
public void dispose()
public boolean startAccessingSecurityScopedResource()
stopAccessingSecurityScopedResource
using the try{}finally{} pattern.true
if the request to access the resource succeeded; otherwise, false
public void stopAccessingSecurityScopedResource()
public byte[] getBookmark()
createFromBookmark
.public static MacFileNSURL createFromBookmark(byte[] data)
true
before calling this method.public byte[] getDocumentScopedBookmark(MacFileNSURL baseDocument)
baseDocument
URL.
An app can store this data, and later re-create the URL with a call
to createFromDocumentScopedBookmark
.NullPointerException
- if baseDocument is null
public static MacFileNSURL createFromDocumentScopedBookmark(byte[] data, MacFileNSURL baseDocument)
baseDocument
URL.
The glass.macosx.enableFileNSURL system property must be set to true
before calling this method.NullPointerException
- if baseDocument is null
Copyright © 2020. All rights reserved.