Dart API Referencedart:htmlEntry

Entry class

DRAFT
This page is not complete.

The Entry interface of the FileSystem API represents entries in a file system. The entries can be a file or a DirectoryEntry.

@DocsEditable
@DomName('Entry')
class Entry native "Entry" {

 @DomName('Entry.filesystem')
 @DocsEditable
 final FileSystem filesystem;

 @DomName('Entry.fullPath')
 @DocsEditable
 final String fullPath;

 @DomName('Entry.isDirectory')
 @DocsEditable
 final bool isDirectory;

 @DomName('Entry.isFile')
 @DocsEditable
 final bool isFile;

 @DomName('Entry.name')
 @DocsEditable
 final String name;

 @JSName('copyTo')
 @DomName('Entry.copyTo')
 @DocsEditable
 void _copyTo(DirectoryEntry parent, {String name, _EntryCallback successCallback, _ErrorCallback errorCallback}) native;

 @JSName('copyTo')
 @DomName('Entry.copyTo')
 @DocsEditable
 Future<Entry> copyTo(DirectoryEntry parent, {String name}) {
   var completer = new Completer<Entry>();
   _copyTo(parent, name : name,
       successCallback : (value) { completer.complete(value); },
       errorCallback : (error) { completer.completeError(error); });
   return completer.future;
 }

 @JSName('getMetadata')
 @DomName('Entry.getMetadata')
 @DocsEditable
 void _getMetadata(MetadataCallback successCallback, [_ErrorCallback errorCallback]) native;

 @JSName('getMetadata')
 @DomName('Entry.getMetadata')
 @DocsEditable
 Future<Metadata> getMetadata() {
   var completer = new Completer<Metadata>();
   _getMetadata(
       (value) { completer.complete(value); },
       (error) { completer.completeError(error); });
   return completer.future;
 }

 @JSName('getParent')
 @DomName('Entry.getParent')
 @DocsEditable
 void _getParent([_EntryCallback successCallback, _ErrorCallback errorCallback]) native;

 @JSName('getParent')
 @DomName('Entry.getParent')
 @DocsEditable
 Future<Entry> getParent() {
   var completer = new Completer<Entry>();
   _getParent(
       (value) { completer.complete(value); },
       (error) { completer.completeError(error); });
   return completer.future;
 }

 @JSName('moveTo')
 @DomName('Entry.moveTo')
 @DocsEditable
 void _moveTo(DirectoryEntry parent, {String name, _EntryCallback successCallback, _ErrorCallback errorCallback}) native;

 @JSName('moveTo')
 @DomName('Entry.moveTo')
 @DocsEditable
 Future<Entry> moveTo(DirectoryEntry parent, {String name}) {
   var completer = new Completer<Entry>();
   _moveTo(parent, name : name,
       successCallback : (value) { completer.complete(value); },
       errorCallback : (error) { completer.completeError(error); });
   return completer.future;
 }

 @JSName('remove')
 @DomName('Entry.remove')
 @DocsEditable
 void _remove(VoidCallback successCallback, [_ErrorCallback errorCallback]) native;

 @JSName('remove')
 @DomName('Entry.remove')
 @DocsEditable
 Future remove() {
   var completer = new Completer();
   _remove(
       () { completer.complete(); },
       (error) { completer.completeError(error); });
   return completer.future;
 }

 @JSName('toURL')
 @DomName('Entry.toURL')
 @DocsEditable
 String toUrl() native;
}

Extends

Interceptor > Entry

Subclasses

DirectoryEntry, FileEntry

Properties

final FileSystem filesystem #

The file system on which the entry resides.
final FileSystem filesystem

final String fullPath #

final String fullPath

final int hashCode #

inherited from Interceptor

Get a hash code for this object.

All objects have hash codes. Hash codes are guaranteed to be the same for objects that are equal when compared using the equality operator ==. Other than that there are no guarantees about the hash codes. They will not be consistent between runs and there are no distribution guarantees.

If a subclass overrides hashCode it should override the equality operator as well to maintain consistency.

docs inherited from Object
int get hashCode => Primitives.objectHashCode(this);

final bool isDirectory #

The entry is a directory.
final bool isDirectory

final bool isFile #

The entry is a file.
final bool isFile

final String name #

The name of the entry, excluding the path leading to it.
final String name

final Type runtimeType #

inherited from Interceptor

A representation of the runtime type of the object.

docs inherited from Object
Type get runtimeType => getRuntimeType(this);

Operators

bool operator ==(other) #

inherited from Interceptor

The equality operator.

The default behavior for all Objects is to return true if and only if this and other are the same object.

If a subclass overrides the equality operator it should override the hashCode method as well to maintain consistency.

docs inherited from Object
bool operator ==(other) => identical(this, other);

Methods

Future<Entry> copyTo(DirectoryEntry parent, {String name}) #

Copy an entry to a different location on the file system. You cannot copy an entry inside itself if it is a directory nor can you copy it into its parent if a name different from its current one isn't provided. Directory copies are always recursive—that is, they copy all contents of the directory.

void vopyTo (
  (in DirectoryEntry parent, optional DOMString newName, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
);
Parameter
parent
The directory to which to move the entry.
newName
The new name of the entry. Defaults to the entry's current name if unspecified.
successCallback
A callback that is called with the entry for the new object.
errorCallback
A callback that is called when errors happen.
Returns
void
@JSName('copyTo')
@DomName('Entry.copyTo')
@DocsEditable
Future<Entry> copyTo(DirectoryEntry parent, {String name}) {
 var completer = new Completer<Entry>();
 _copyTo(parent, name : name,
     successCallback : (value) { completer.complete(value); },
     errorCallback : (error) { completer.completeError(error); });
 return completer.future;
}

Future<Metadata> getMetadata() #

Look up metadata about this entry.

void getMetada (
  in MetadataCallback ErrorCallback
);
Parameter
successCallback
A callback that is called with the time of the last modification.
errorCallback
A callback that is called when errors happen.
Returns
void
@JSName('getMetadata')
@DomName('Entry.getMetadata')
@DocsEditable
Future<Metadata> getMetadata() {
 var completer = new Completer<Metadata>();
 _getMetadata(
     (value) { completer.complete(value); },
     (error) { completer.completeError(error); });
 return completer.future;
}

Future<Entry> getParent() #

Look up the parent DirectoryEntry containing this entry. If this entry is the root of its filesystem, its parent is itself.

void getParent (
  (in EntryCallback successCallback, optional ErrorCallback errorCallback);
);
Parameter
parent
The directory to which to move the entry.
newName
The new name of the entry. Defaults to the entry's current name if unspecified.
successCellback
A callback that is called with the entry for the new object.
errorCallback
A callback that is called when errors happen.
Returns
void
@JSName('getParent')
@DomName('Entry.getParent')
@DocsEditable
Future<Entry> getParent() {
 var completer = new Completer<Entry>();
 _getParent(
     (value) { completer.complete(value); },
     (error) { completer.completeError(error); });
 return completer.future;
}

Future<Entry> moveTo(DirectoryEntry parent, {String name}) #

Move an entry to a different location on the file system. You cannot do the following:

  • move a directory inside itself or to any child at any depth;
  • move an entry into its parent if a name different from its current one isn't provided;
  • move a file to a path occupied by a directory;
  • move a directory to a path occupied by a file;
  • move any element to a path occupied by a directory which is not empty.

Moving a file over an existing file replaces that existing file. A move of a directory on top of an existing empty directory replaces that directory.

void moveTo (
  (in DirectoryEntry parent, optional DOMString newName, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
);
Parameter
parent
The directory to which to move the entry.
newName
The new name of the entry. Defaults to the entry's current name if unspecified.
successCallback
A callback that is called with the entry for the new object.
errorCallback
A callback that is called when errors happen.
Returns
void
@JSName('moveTo')
@DomName('Entry.moveTo')
@DocsEditable
Future<Entry> moveTo(DirectoryEntry parent, {String name}) {
 var completer = new Completer<Entry>();
 _moveTo(parent, name : name,
     successCallback : (value) { completer.complete(value); },
     errorCallback : (error) { completer.completeError(error); });
 return completer.future;
}

dynamic noSuchMethod(Invocation invocation) #

inherited from Interceptor

noSuchMethod is invoked when users invoke a non-existant method on an object. The name of the method and the arguments of the invocation are passed to noSuchMethod in an Invocation. If noSuchMethod returns a value, that value becomes the result of the original invocation.

The default behavior of noSuchMethod is to throw a noSuchMethodError.

docs inherited from Object
dynamic noSuchMethod(Invocation invocation) {
 throw new NoSuchMethodError(
     this,
     _symbolToString(invocation.memberName),
     invocation.positionalArguments,
     _symbolMapToStringMap(invocation.namedArguments));
}

Future remove() #

Deletes a file or directory. You cannot delete an empty directory or the root directory of a filesystem.

void remove (
  (in VoidCallback successCallback, optional ErrorCallback errorCallback);
);
Parameter
successCallback
A callback that is called with the entry for the new object.
errorCallback
A callback that is called when errors happen.
Returns
void
@JSName('remove')
@DomName('Entry.remove')
@DocsEditable
Future remove() {
 var completer = new Completer();
 _remove(
     () { completer.complete(); },
     (error) { completer.completeError(error); });
 return completer.future;
}

String toString() #

inherited from Interceptor

Returns a string representation of this object.

docs inherited from Object
String toString() => Primitives.objectToString(this);

String toUrl() #

Returns a URL that can be used to identify this entry. It has no specific expiration. Bcause it describes a location on disk, it is valid for as long as that location exists. Users can supply mimeType to simulate the optional mime-type header associated with HTTP downloads.

DOMString toURL (
  (in optional DOMString mimeType);
);
Parameter
mimeType
For a FileEntry, the mime type to be used to interpret the file, when loaded through this URL.
Returns
DOMString
@JSName('toURL')
@DomName('Entry.toURL')
@DocsEditable
String toUrl() native;

This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.