public class

AttachmentZipKit

extends Object
java.lang.Object
   ↳ com.atlassian.jira.issue.attachment.AttachmentZipKit

Class Overview

This class will help when working with zip files

Summary

Nested Classes
interface AttachmentZipKit.AttachmentZipEntries  
interface AttachmentZipKit.AttachmentZipEntry These are the data returned about entries in a zip file  
enum AttachmentZipKit.FileCriteria  
class AttachmentZipKit.ZipEntryInputStream  
Public Constructors
AttachmentZipKit()
Public Methods
AttachmentZipKit.ZipEntryInputStream extractFile(File zipFile, long entryIndex)
This will extract an OutputStream of the contents of the file at entryIndex within the zip file.
boolean isZip(File file)
This will return true if the file is in fact a valid zip file.
AttachmentZipKit.AttachmentZipEntries listEntries(File zipFile, int maxEntries, AttachmentZipKit.FileCriteria criteria)
This will return a list of AttachmentZipKit.AttachmentZipEntrys for a given zip file
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AttachmentZipKit ()

Public Methods

public AttachmentZipKit.ZipEntryInputStream extractFile (File zipFile, long entryIndex)

This will extract an OutputStream of the contents of the file at entryIndex within the zip file. If no file can be found be at that entryIndex or the entry is a directory then null will be returned.

Parameters
zipFile the zip file in play
entryIndex the entryIndex of the entry to return
Returns
Throws
IOException if things go wrong during reading

public boolean isZip (File file)

This will return true if the file is in fact a valid zip file.

Parameters
file the file in play.
Returns
  • true if its actually a readable zip file.

public AttachmentZipKit.AttachmentZipEntries listEntries (File zipFile, int maxEntries, AttachmentZipKit.FileCriteria criteria)

This will return a list of AttachmentZipKit.AttachmentZipEntrys for a given zip file

Parameters
zipFile the ZIP file in play
maxEntries the maximum number of entries to put in th list. If this is -negative then not maximum is used.
criteria the criteria of which entries to return
Returns
  • a list of entries
Throws
IOException if the file cant be read or is not a zip. file.