Class SimpleInArchiveItemImpl
java.lang.Object
net.sf.sevenzipjbinding.simple.impl.SimpleInArchiveItemImpl
- All Implemented Interfaces:
ISimpleInArchiveItem
Standard implementation of
ISimpleInArchiveItem, simplified 7-Zip-JBinding interface.- Since:
- 4.65-1
- Author:
- Boris Brodski
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleInArchiveItemImpl(IInArchive sevenZipInArchive, int index) Create instance ofSimpleInArchiveItemImplrepresenting archive item with index indexindexof archivesevenZipInArchive.SimpleInArchiveItemImpl(SimpleInArchiveImpl simpleInArchiveImpl, int index) Create instance ofSimpleInArchiveItemImplrepresenting archive item with index indexindexof archivesimpleInArchiveImpl. -
Method Summary
Modifier and TypeMethodDescriptionextractSlow(ISequentialOutStream outStream) Extract one archive item.extractSlow(ISequentialOutStream outStream, String password) Extract one archive item.Return item attributes.
Supported by the following formats:Zip7ZArjCabRarReturn comments for the item.getCRC()Return CRC checksum of the item content.Return creation date and time of the item.
Supported by the following formats:7ZRargetGroup()Return parent group of the item.Return the host operating system recorded for the item, i.e.intReturns the archive item indexReturn last access date and time of the item.
Supported by the following formats:7ZRarReturn last write date and time of the item.
Supported by all formats except the following:BZ2ChmRPMSplitZReturn string title of item compress method.Size of the packed item in archive.getPath()Full path, name and extension of the file inside the archive.Return the value of the item'sPOSITIONproperty.getSize()Original (uncompressed) size of the item in bytes.getUser()Return parent user of the item.Returntrueif item was commented, otherwisefalse.booleanFlag indicating whether the item is encrypted or not.booleanisFolder()Returns a flag indicating whether the item represents a folder or not.
-
Constructor Details
-
SimpleInArchiveItemImpl
Create instance ofSimpleInArchiveItemImplrepresenting archive item with index indexindexof archivesimpleInArchiveImpl.- Parameters:
simpleInArchiveImpl- opened archiveindex- index of the item in archive
-
SimpleInArchiveItemImpl
Create instance ofSimpleInArchiveItemImplrepresenting archive item with index indexindexof archivesevenZipInArchive.- Parameters:
sevenZipInArchive- opened archiveindex- index of the item in archive
-
-
Method Details
-
getPath
Full path, name and extension of the file inside the archive. Example:'dir/file.ext'. Please note that stream archive formats such as gzip do not support this property, since they always compress a single file (or stream).- Specified by:
getPathin interfaceISimpleInArchiveItem- Returns:
- full path, name and extension of the item in archive.
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getAttributes
Return item attributes.
Supported by the following formats:-
Zip -
7Z -
Arj -
Cab -
Rar
- Specified by:
getAttributesin interfaceISimpleInArchiveItem- Returns:
- attributes of item
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
-
getCRC
Return CRC checksum of the item content.- Specified by:
getCRCin interfaceISimpleInArchiveItem- Returns:
- CRC checksum of the item content
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getComment
Return comments for the item.- Specified by:
getCommentin interfaceISimpleInArchiveItem- Returns:
- comments for the item.
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getCreationTime
Return creation date and time of the item.
Supported by the following formats:-
7Z -
Rar
- Specified by:
getCreationTimein interfaceISimpleInArchiveItem- Returns:
- creation date and time of the item
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
-
getGroup
Return parent group of the item.- Specified by:
getGroupin interfaceISimpleInArchiveItem- Returns:
- parent group of the item.
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getHostOS
Return the host operating system recorded for the item, i.e. the operating system on which the item was added to the archive. This is mainly relevant for formats such as Zip and RAR.- Specified by:
getHostOSin interfaceISimpleInArchiveItem- Returns:
- host OS of the item.
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getLastAccessTime
Return last access date and time of the item.
Supported by the following formats:-
7Z -
Rar
- Specified by:
getLastAccessTimein interfaceISimpleInArchiveItem- Returns:
- last access date and time of the item.
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
-
getLastWriteTime
Return last write date and time of the item.
Supported by all formats except the following:-
BZ2 -
Chm -
RPM -
Split -
Z
- Specified by:
getLastWriteTimein interfaceISimpleInArchiveItem- Returns:
- last write date and time of the item
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
-
getMethod
Return string title of item compress method.- Specified by:
getMethodin interfaceISimpleInArchiveItem- Returns:
- string title of item compress method
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getPackedSize
Size of the packed item in archive. Sometimes0will be returned. It means either unknown or the item shares compressed data with other items and so take no additional space in archive.- Specified by:
getPackedSizein interfaceISimpleInArchiveItem- Returns:
- packed size of item in archive
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getPosition
Return the value of the item'sPOSITIONproperty. This is a rarely used, format-specific property; for most archive formats it is not defined.- Specified by:
getPositionin interfaceISimpleInArchiveItem- Returns:
- value of the
POSITIONproperty
nullwill be returned, if the current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getSize
Original (uncompressed) size of the item in bytes.- Specified by:
getSizein interfaceISimpleInArchiveItem- Returns:
- original size of the item in bytes
nullwill be returned, if the current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getUser
Return parent user of the item.- Specified by:
getUserin interfaceISimpleInArchiveItem- Returns:
- parent user of the item.
nullwill be returned, if current archive type doesn't support this property. - Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
isCommented
Returntrueif item was commented, otherwisefalse.- Specified by:
isCommentedin interfaceISimpleInArchiveItem- Returns:
trueif item was commented, otherwisefalse.
nullwill be returned, if current archive type doesn't support this property.- Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
isEncrypted
Flag indicating whether the item is encrypted or not.- Specified by:
isEncryptedin interfaceISimpleInArchiveItem- Returns:
trueif item is encrypted, otherwisefalse.falseis returned, if archive format doesn't support this property.- Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
isFolder
Returns a flag indicating whether the item represents a folder or not. Please note that some archive formats do not define special items for folders. In this case you may get an item with a path'dir/file'without having an item for'dir'at all.
- Specified by:
isFolderin interfaceISimpleInArchiveItem- Returns:
trueif item is a folder, otherwisefalse.falseis returned, if archive format doesn't support this property.- Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
extractSlow
Description copied from interface:ISimpleInArchiveItemExtract one archive item. UsesequentialOutStreamto output data.
WARNING: this is a very slow operation when called repeatedly.- Specified by:
extractSlowin interfaceISimpleInArchiveItem- Parameters:
outStream- output stream to use- Returns:
- result of operation
- Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
extractSlow
public ExtractOperationResult extractSlow(ISequentialOutStream outStream, String password) throws SevenZipException Description copied from interface:ISimpleInArchiveItemExtract one archive item. UsesequentialOutStreamto output data.
WARNING: this is a very slow operation when called repeatedly.- Specified by:
extractSlowin interfaceISimpleInArchiveItem- Parameters:
outStream- output stream to usepassword- password to use- Returns:
- result of operation
- Throws:
SevenZipException- 7-Zip or 7-Zip-JBinding error occurs. UseSevenZipException.printStackTraceExtended()to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
-
getItemIndex
public int getItemIndex()Returns the archive item index- Specified by:
getItemIndexin interfaceISimpleInArchiveItem- Returns:
- the archive item index
-