net.sf.sevenzipjbinding.simple.impl
Class SimpleInArchiveItemImpl

java.lang.Object
  extended by net.sf.sevenzipjbinding.simple.impl.SimpleInArchiveItemImpl
All Implemented Interfaces:
ISimpleInArchiveItem

public class SimpleInArchiveItemImpl
extends java.lang.Object
implements ISimpleInArchiveItem

Standard implementation of ISimpleInArchiveItem, simplified 7-Zip-JBinding interface.

Since:
4.65-1
Author:
Boris Brodski

Constructor Summary
SimpleInArchiveItemImpl(IInArchive sevenZipInArchive, int index)
          Create instance of SimpleInArchiveItemImpl representing archive item with index indexindex of archive sevenZipInArchive.
SimpleInArchiveItemImpl(SimpleInArchiveImpl simpleInArchiveImpl, int index)
          Create instance of SimpleInArchiveItemImpl representing archive item with index indexindex of archive simpleInArchiveImpl.
 
Method Summary
 ExtractOperationResult extractSlow(ISequentialOutStream outStream)
          Extract one archive item.
 ExtractOperationResult extractSlow(ISequentialOutStream outStream, java.lang.String password)
          Extract one archive item.
 java.lang.Integer getAttributes()
          Return item attributes.

Supported by all methods
  • Zip
  • 7Z
  • Arj
  • Cab
  • Rar
 java.lang.String getComment()
          Return comments for the item.
 java.lang.Integer getCRC()
          Return CRC checksum of the item content.
 java.util.Date getCreationTime()
          Return creation date and time of the item.

Supported by all methods
  • 7Z
  • Rar
 java.lang.String getGroup()
          Return parent group of the item.
 java.lang.String getHostOS()
          Return host OS of item.
 int getItemIndex()
          Returns the archive item index
 java.util.Date getLastAccessTime()
          Return last access date and time of the item.

Supported by all methods
  • 7Z
  • Rar
 java.util.Date getLastWriteTime()
          Return last write date and time of the item.

Supported by all methods, but
  • BZ2
  • Chm
  • RPM
  • Split
  • Z
 java.lang.String getMethod()
          Return string title of item compress method.
 java.lang.Long getPackedSize()
          Size of the packed item in archive.
 java.lang.String getPath()
          Full path, name and extension of the file inside the archive.
 java.lang.Integer getPosition()
          TODO: the purpose of position isn't clear
 java.lang.Long getSize()
          Original size of the item.
 java.lang.String getUser()
          Return parent user of the item.
 java.lang.Boolean isCommented()
          Return true if item was commented, otherwise false.
 boolean isEncrypted()
          Flag either a item encrypted or not.
 boolean isFolder()
          Returns flag either a item represents a folder or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleInArchiveItemImpl

public SimpleInArchiveItemImpl(SimpleInArchiveImpl simpleInArchiveImpl,
                               int index)
Create instance of SimpleInArchiveItemImpl representing archive item with index indexindex of archive simpleInArchiveImpl.

Parameters:
simpleInArchiveImpl - opened archive
index - index of the item in archive

SimpleInArchiveItemImpl

public SimpleInArchiveItemImpl(IInArchive sevenZipInArchive,
                               int index)
Create instance of SimpleInArchiveItemImpl representing archive item with index indexindex of archive sevenZipInArchive.

Parameters:
sevenZipInArchive - opened archive
index - index of the item in archive
Method Detail

getPath

public java.lang.String getPath()
                         throws SevenZipException
Full path, name and extension of the file inside the archive. Example. 'dir/file.ext'. Please note, that stream archive formats such as gzip does not support this property, since it is always a single file (or stream) being compressed.

Specified by:
getPath in interface ISimpleInArchiveItem
Returns:
full path, name and extension of the item in archive.
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getAttributes

public java.lang.Integer getAttributes()
                                throws SevenZipException
Return item attributes.

Supported by all methods

Specified by:
getAttributes in interface ISimpleInArchiveItem
Returns:
attributes of item
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getCRC

public java.lang.Integer getCRC()
                         throws SevenZipException
Return CRC checksum of the item content.

Specified by:
getCRC in interface ISimpleInArchiveItem
Returns:
CRC checksum of the item content
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getComment

public java.lang.String getComment()
                            throws SevenZipException
Return comments for the item.

Specified by:
getComment in interface ISimpleInArchiveItem
Returns:
comments for the item.
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getCreationTime

public java.util.Date getCreationTime()
                               throws SevenZipException
Return creation date and time of the item.

Supported by all methods

Specified by:
getCreationTime in interface ISimpleInArchiveItem
Returns:
creation date and time of the item
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getGroup

public java.lang.String getGroup()
                          throws SevenZipException
Return parent group of the item.

Specified by:
getGroup in interface ISimpleInArchiveItem
Returns:
parent group of the item.
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getHostOS

public java.lang.String getHostOS()
                           throws SevenZipException
Return host OS of item. TODO: The meaning of the hostOS property is unknown

Specified by:
getHostOS in interface ISimpleInArchiveItem
Returns:
host OS of item.
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getLastAccessTime

public java.util.Date getLastAccessTime()
                                 throws SevenZipException
Return last access date and time of the item.

Supported by all methods

Specified by:
getLastAccessTime in interface ISimpleInArchiveItem
Returns:
last access date and time of the item.
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getLastWriteTime

public java.util.Date getLastWriteTime()
                                throws SevenZipException
Return last write date and time of the item.

Supported by all methods, but

Specified by:
getLastWriteTime in interface ISimpleInArchiveItem
Returns:
last write date and time of the item
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getMethod

public java.lang.String getMethod()
                           throws SevenZipException
Return string title of item compress method.

Specified by:
getMethod in interface ISimpleInArchiveItem
Returns:
string title of item compress method
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getPackedSize

public java.lang.Long getPackedSize()
                             throws SevenZipException
Size of the packed item in archive. Sometimes 0 will 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:
getPackedSize in interface ISimpleInArchiveItem
Returns:
packed size of item in archive
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getPosition

public java.lang.Integer getPosition()
                              throws SevenZipException
TODO: the purpose of position isn't clear

Specified by:
getPosition in interface ISimpleInArchiveItem
Returns:
TODO
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getSize

public java.lang.Long getSize()
                       throws SevenZipException
Original size of the item. -1 is returned, if no size known for this item.

Specified by:
getSize in interface ISimpleInArchiveItem
Returns:
Original size of the item or -1
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getUser

public java.lang.String getUser()
                         throws SevenZipException
Return parent user of the item.

Specified by:
getUser in interface ISimpleInArchiveItem
Returns:
parent user of the item.
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

isCommented

public java.lang.Boolean isCommented()
                              throws SevenZipException
Return true if item was commented, otherwise false.

Specified by:
isCommented in interface ISimpleInArchiveItem
Returns:
true if item was commented, otherwise false.
null will be returned, if current archive type doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

isEncrypted

public boolean isEncrypted()
                    throws SevenZipException
Flag either a item encrypted or not.

Specified by:
isEncrypted in interface ISimpleInArchiveItem
Returns:
true if item is encrypted, otherwise false. false is returned, if archive format doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

isFolder

public boolean isFolder()
                 throws SevenZipException
Returns flag either a item represents a folder or not. Please note, that some archive formats doesn't define special items for folders. In this case you may get a item with a path 'dir/file' without having an item for 'dir' at all.

Specified by:
isFolder in interface ISimpleInArchiveItem
Returns:
true if item is a folder, otherwise false. false is returned, if archive format doesn't support this property.
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

extractSlow

public ExtractOperationResult extractSlow(ISequentialOutStream outStream)
                                   throws SevenZipException
Description copied from interface: ISimpleInArchiveItem
Extract one archive item. Use sequentialOutStream to output data.

WARNING: this is very slow operation for multiple calls.

Specified by:
extractSlow in interface ISimpleInArchiveItem
Parameters:
outStream - output stream to use
Returns:
result of operation
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

extractSlow

public ExtractOperationResult extractSlow(ISequentialOutStream outStream,
                                          java.lang.String password)
                                   throws SevenZipException
Description copied from interface: ISimpleInArchiveItem
Extract one archive item. Use sequentialOutStream to output data.

WARNING: this is very slow operation for multiple calls.

Specified by:
extractSlow in interface ISimpleInArchiveItem
Parameters:
outStream - output stream to use
password - password to use
Returns:
result of operation
Throws:
SevenZipException - 7-Zip or 7-Zip-JBinding error occur. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of the all thrown 'cause by' exceptions.

getItemIndex

public int getItemIndex()
Returns the archive item index

Specified by:
getItemIndex in interface ISimpleInArchiveItem
Returns:
the archive item index