JARFile Type

The Jar file in the archive.

Remarks

This type contains information about the Jar file that either exists in the archive or is being added to the archive.

Fields

CompressedDate
Long

The date and time of the entry, as stored within the archive.

FileCompressedDate contains the last modified date of the file, as stored within the archive (it does not generally correspond to when the file was compressed).

FileCompressedDate is returned in a platform-specific format. The Java,C++, and most other Editions will return the number of milliseconds since January 1, 1970, 00:00:00. This value may be passed directly to the java.util.Date constructor to create a java.util.Date object representing this date.

The .NET Edition will return the number of ticks, or 100-nanosecond intervals, since January 1, 0001, 00:00:00. This value may be passed directly to the System.DateTime constructor to create a System.DateTime object representing this date.

Reading the value of this property will return a meaningful value only after the archive has been successfully scanned or decompressed, and only if the values of ArchiveFile, Files collection, and CompressedName have not been changed since. If a meaningful value is not available this property will return a value of 0.

NOTE: This may be set accordingly when the InputStream field is set to a valid stream to input the data for the current file. If not set, the default, 0, is used. Otherwise the value is read from disk.

CompressedName
String

The file name of the current file, as stored inside of the archive. This may be the same as in DecompressedName, but is not required to be.

All paths are stored in the archive in standard (UNIX) format. Pathnames specified in the host operating system's format will be immediately converted.

This field should generally be set with a relative path or with no path at all. The exact interpretation of the path is left to the decompression software; generally, pathnames will be interpreted as relative to a base directory, and these subdirectories will be created as needed. Absolute pathnames will not be interpreted correctly by the component, and may or may not be interpreted correctly by other decompression software.

Paths should be specified in standard (UNIX) format. They may also be specified in the format native to the host operating system, in which case they will be immediately converted.

Example


ZipControl.ArchiveFile = "c:\test.zip"
ZipControl.Files.Add(new ZIPFile())
ZipControl.Files[0].DecompressedName = "c:\test\ipworkszip\temp\test.txt"
ZipControl.Files[0].CompressedName = "readme.txt"
ZipControl.Compress()

CompressedSize
Long

The size of the compressed data, as compressed within the archive. Headers, footers, etc., are not included in the size.

Reading the value of this property will return a meaningful value only after the archive has been compressed, scanned, or decompressed, and only if the values of ArchiveFile, or Files have not been changed since. If a meaningful value is not available this property will return a value of -1.

DecompressedName
String

The name of the file in the archive, as stored on the file system, outside the archive.

When compressing files, This field should be specified with a path, if necessary, to allow the file to be found by the component. If the file cannot be found during compression, a trappable error will be generated, and the archive will not be correctly written.

When decompressing files, the field indicates where the file should be written. After the archive is scanned, the values of CompressedName and DecompressedName will be set to the exact filenames found in the archive. The value of DecompressedName may then be changed if desired.

If DecompressedName is set to an empty string before extraction, the file will not be written to disk at all. It will still be written to the Progress event if WriteToProgressEvent is set to true.

If DecompressedName is set to an empty string before compression, the file will be skipped, and not written to the archive.

A base path for decompression may be specified by setting the ExtractToPath property. If ExtractToPath is set to a non-empty string, the files will be decompressed to the directory specified in ExtractToPath. If the value of DecompressedName contains a pathname it will be regarded as relative to ExtractToPath.

Paths on the local file system should be specified in the format native to the host operating system. They may also be specified in standard (UNIX) format, in which case they will be immediately converted.

Example


ZipControl.ArchiveFile = "c:\test.tar"
ZipControl.Scan()
ZipControl.ExtractToPath = "c:\temp\"
ZipControl.Files[1].DecompressedName = "test\temp.out"
ZipControl.Extract(ZipControl.Files[1].CompressedName)
Incorrect Example
ZipControl.ExtractToPath = "c:\temp\"
ZipControl.Files[1].DecompressedName = "c:\temp\test\temp.out"
'The file would be extracted to c:\temp\c:\temp\test\temp.out

DecompressedSize
Long

The size of the file, as decompressed outside the archive. If an archive is open for read (i.e. has been scanned or decompressed), this information will be read from the archive headers. If an archive is not open for read, the component will retrieve the information for the corresponding value of DecompressedName from the local file system.

A value of -1 will be returned in case of an I/O error.

InputData
String

When This field is set, the component will read in the data from This field instead of reading from the file contained in the DecompressedName field.

InputDataB
Byte[]

When This field is set, the component will read in the data from This field instead of reading from the file contained in the DecompressedName field.

InputStream
System.IO.Stream

When This field is set to a valid stream, the component will read in the data from the stream as the current file instead of reading from the file contained in the DecompressedName field.

Constructors

public JARFile();
Public JARFile()
public JARFile(string decompressedName);
Public JARFile(ByVal DecompressedName As String)
public JARFile(string compressedName, string decompressedName);
Public JARFile(ByVal CompressedName As String, ByVal DecompressedName As String)
public JARFile(string compressedName, System.IO.Stream inputStream);
Public JARFile(ByVal CompressedName As String, ByVal InputStream As System.IO.Stream)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 .NET Edition - Version 20.0 [Build 8300]