Interface IOutUpdateArchive<T extends IOutItemBase>

Type Parameters:
T - the type of the corresponding archive item data class (out item), like IOutItem7z or IOutItemZip. Use IOutItemAllFormats interface to support all available archive formats.
All Superinterfaces:
IOutArchiveBase
All Known Subinterfaces:
IOutArchive<T>, IOutUpdateArchive7z, IOutUpdateArchiveBZip2, IOutUpdateArchiveGZip, IOutUpdateArchiveTar, IOutUpdateArchiveXz, IOutUpdateArchiveZip
All Known Implementing Classes:
OutArchive7zImpl, OutArchiveBZip2Impl, OutArchiveGZipImpl, OutArchiveImpl, OutArchiveTarImpl, OutArchiveXzImpl, OutArchiveZipImpl

public interface IOutUpdateArchive<T extends IOutItemBase> extends IOutArchiveBase
The interface provides functionality to update an existing archive. The standard way to get the implementation is to use IInArchive.getConnectedOutArchive() method like this:

  IInArchive inArchive = SevenZip.openInArchive(ArchiveFormat.SEVEN_ZIP, inStream);
  IOutUpdateArchive<IOutItemAllFormats> outArchive = inArchive.getConnectedOutArchive();

  if (outArchive instanceof IOutFeatureSetLevel) {
      ((IOutFeatureSetLevel)outArchive).setLevel(myLevel);
  }

  outArchive.updateItems(...);
  ...

  inArchive.close();
 

No explicit closing is necessary. A connected out-archive gets closed automatically when the corresponding in-archive gets closed.
Since:
9.20-2.00
Author:
Boris Brodski
See Also:
  • Method Details

    • updateItems

      void updateItems(ISequentialOutStream outStream, int numberOfItems, IOutCreateCallback<T> outCreateCallback) throws SevenZipException
      Update items in archive (actually creating a new one based on the old one).
      Parameters:
      outStream - output stream to get the new archive
      numberOfItems - number of items in the new archive
      outCreateCallback - create call back object to provide more information for archive update operation.
      Throws:
      SevenZipException - 7-Zip or 7-Zip-JBinding error occurs. Use SevenZipException.printStackTraceExtended() to get stack traces of this SevenZipException and of all thrown 'caused by' exceptions.
    • getArchiveFormat

      ArchiveFormat getArchiveFormat()
      Return the archive format of this out-archive instance
      Returns:
      the archive format of this out-archive instance
    • getConnectedInArchive

      IInArchive getConnectedInArchive()
      Get connected IInArchive for update operations.
      Returns:
      connected IInArchive for update operations