ArchiveFile class
A file contained in an Archive.
Constructors
-
ArchiveFile.new(String name, int size, List<
int> data) - Alias for ArchiveFile.bytes for backwards compatibility.
-
ArchiveFile.bytes(String name, List<
int> data) -
A file storing the given
data
. - ArchiveFile.directory(String name)
- A directory, usually representing an empty directory in an archive.
- ArchiveFile.file(String name, int size, FileContent file)
-
A file that gets its content from the given
file
. -
ArchiveFile.noCompress(String name, int size, List<
int> data) -
Helper constructor to define a file storing the given
data
, which remains uncompressed in the archive. - ArchiveFile.noData(String name)
- An empty file.
- ArchiveFile.stream(String name, InputStream stream)
-
A file that gets its content from the given
stream
. - ArchiveFile.string(String name, String content)
-
A file storing the given string data
content
. - ArchiveFile.symlink(String name, String symbolicLink)
- A file that's a symlink to another file.
- ArchiveFile.typedData(String name, TypedData data)
-
A file storing the given
data
.factory
Properties
- comment ↔ String?
-
An optional comment for the archive entry.
getter/setter pair
- compression ↔ CompressionType?
-
The type of compression to use when encoding an archive.
If this is not set, the default compression type will be used.
For a zip file, this is deflate compression.
This value is set when decoding a zip to the method of compression
the file was stored in the zip file. It does not indicate the current
compression of the file's content, it is only used for how the file
should be compressed when encoding a zip.
getter/setter pair
- compressionLevel ↔ int?
-
The level of compression to use when encoding an archive.
If this is not set, the default level of compression will be used.
This value is only used for encoding an archive, allowing you to control
the compression level of individual files in an archive. It is not set
when decoding an archive.
getter/setter pair
- content → Uint8List
-
Alias to readBytes, kept for backwards compatibility.
no setter
- crc32 ↔ int?
-
The crc32 checksum of the uncompressed content.
getter/setter pair
- creationTime ↔ int
-
The creation timestamp of the file or directory, in seconds from
epoch.
getter/setter pair
- groupId ↔ int
-
The group id of the file or directory.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCompressed → bool
-
True if the data stored by this file currently compressed
no setter
- isDirectory → bool
-
If true, the file represents a directory.
no setter
- isFile ↔ bool
-
If false, the file represents a directory.
getter/setter pair
- isSymbolicLink → bool
-
True if the entry is a symbolic link, otherwise false.
no setter
- lastModDateTime → DateTime
-
no setter
- lastModTime ↔ int
-
The timestamp the file or directory was last modified, in seconds since
epoch.
getter/setter pair
- mode ↔ int
-
The access mode of the file or directory.
getter/setter pair
- name ↔ String
-
The name of the file or directory.
getter/setter pair
- ownerId ↔ int
-
The owner id of the file or directory.
getter/setter pair
- rawContent → FileContent?
-
Get the content without decompressing it first.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size ↔ int
-
The size of the file, in bytes. This is set when decoding an archive,
it isn't used for encoding.
getter/setter pair
- symbolicLink ↔ String?
-
If symbolicLink is not null, the entry is a symbolic link and this is
the path to what it's linking to. This should be an archive relative path.
Symlinks pointing outside of the archive will be invalid when extracting
archives to disk.
getter/setter pair
- unixPermissions → int
-
The unix permission flags of the file.
no setter
Methods
-
clear(
) → void - Clears the memory used without closing the underlying file handle.
-
close(
) → Future< void> - Clear the used memory and asynchronously close the underlying file handle.
-
closeSync(
) → void - Clear the used memory and close the underlying file handle.
-
decompress(
[OutputStream? output]) → void -
If the file data is compressed, decompress it.
Optionally write the decompressed content to
output
, otherwise the decompressed content is stored with this ArchiveFile in its cached contents. -
getContent(
) → InputStream? - Get the content of the file, decompressing on demand as necessary.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readBytes(
) → Uint8List? - Get the decompressed bytes of the file.
-
toString(
) → String -
A string representation of this object.
inherited
-
writeContent(
OutputStream output, {bool freeMemory = true}) → void -
Write the contents of the file to the given
output
. IffreeMemory
is true, then any storage of decompressed data will be freed after the write has completed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited