Package io.github.astrapi69.file.zip
Class Zipper
- java.lang.Object
-
- io.github.astrapi69.file.zip.Zipper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Zipper.ZipperBuilder
-
Constructor Summary
Constructors Constructor Description Zipper()
Instantiates a newZipper
objectZipper(int compressionMethod, java.io.File directoryToZip, java.lang.String dirToStart, int fileCounter, java.io.FilenameFilter fileFilter, long fileLength, java.io.File zipFile, java.lang.String zipFileComment, java.lang.String zipFileName, java.util.zip.ZipFile zipFileObj, int zipLevel)
Instantiates a newZipper
objectZipper(java.io.File dirToZip, java.io.File zipFile)
Instantiates a newZipper
objectZipper(java.io.File dirToZip, java.io.File zipFile, java.io.FilenameFilter filter)
Instantiates a newZipper
object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Zipper.ZipperBuilder
builder()
int
getCompressionMethod()
Returns the fieldcompressionMethod
.java.io.File
getDirectoryToZip()
Returns the fielddirectoryToZip
.java.lang.String
getDirToStart()
Returns the fielddirToStart
.int
getFileCounter()
Returns the fieldfileCounter
.java.io.FilenameFilter
getFileFilter()
Returns the fieldfileFilter
.long
getFileLength()
Returns the fieldfileLength
.java.io.File
getZipFile()
Returns the fieldzipFile
.java.lang.String
getZipFileComment()
Returns the fieldzipFileComment
.java.lang.String
getZipFileName()
Returns the fieldzipFileName
.java.util.zip.ZipFile
getZipFileObj()
Returns the fieldzipFileObj
.int
getZipLevel()
Returns the fieldzipLevel
.void
setCompressionMethod(int compressionMethod)
Sets the fieldcompressionMethod
.void
setDirectoryToZip(java.io.File directoryToZip)
Sets the fielddirectoryToZip
.void
setDirToStart(java.lang.String dirToStart)
Sets the fielddirToStart
.void
setFileCounter(int fileCounter)
Sets the fieldfileCounter
.void
setFileFilter(java.io.FilenameFilter fileFilter)
Sets the fieldfileFilter
.void
setFileLength(long fileLength)
Sets the fieldfileLength
.void
setZipFile(java.io.File zipFile)
Sets the fieldzipFile
.void
setZipFileComment(java.lang.String zipFileComment)
Sets the fieldzipFileComment
.void
setZipFileName(java.lang.String zipFileName)
Sets the fieldzipFileName
.void
setZipFileObj(java.util.zip.ZipFile zipFileObj)
Sets the fieldzipFileObj
.void
setZipLevel(int zipLevel)
Sets the fieldzipLevel
.Zipper.ZipperBuilder
toBuilder()
java.lang.String
toString()
java.util.Optional<ZipErrorCodes>
zip()
Zip the given files of this object
-
-
-
Constructor Detail
-
Zipper
public Zipper()
Instantiates a newZipper
object
-
Zipper
public Zipper(java.io.File dirToZip, java.io.File zipFile)
Instantiates a newZipper
object- Parameters:
dirToZip
- the dir to zipzipFile
- the zip file
-
Zipper
public Zipper(java.io.File dirToZip, java.io.File zipFile, java.io.FilenameFilter filter)
Instantiates a newZipper
object- Parameters:
dirToZip
- the dir to zipzipFile
- the zip filefilter
- the filter
-
Zipper
public Zipper(int compressionMethod, java.io.File directoryToZip, java.lang.String dirToStart, int fileCounter, java.io.FilenameFilter fileFilter, long fileLength, java.io.File zipFile, java.lang.String zipFileComment, java.lang.String zipFileName, java.util.zip.ZipFile zipFileObj, int zipLevel)
Instantiates a newZipper
object- Parameters:
compressionMethod
- the compression methoddirectoryToZip
- the directory to zipdirToStart
- the directory to startfileCounter
- the file counterfileFilter
- the file name filterfileLength
- the file lengthzipFile
- the zip filezipFileComment
- the zip file commentzipFileName
- the zip file namezipFileObj
- the zip file objectzipLevel
- the compression level
-
-
Method Detail
-
builder
public static Zipper.ZipperBuilder builder()
-
getCompressionMethod
public int getCompressionMethod()
Description copied from interface:ZipModel
Returns the fieldcompressionMethod
.- Specified by:
getCompressionMethod
in interfaceZipModel
- Returns:
- The field
compressionMethod
.
-
setCompressionMethod
public void setCompressionMethod(int compressionMethod)
Description copied from interface:ZipModel
Sets the fieldcompressionMethod
.- Specified by:
setCompressionMethod
in interfaceZipModel
- Parameters:
compressionMethod
- ThecompressionMethod
to set
-
getDirectoryToZip
public java.io.File getDirectoryToZip()
Description copied from interface:ZipModel
Returns the fielddirectoryToZip
.- Specified by:
getDirectoryToZip
in interfaceZipModel
- Returns:
- The field
directoryToZip
.
-
setDirectoryToZip
public void setDirectoryToZip(java.io.File directoryToZip)
Description copied from interface:ZipModel
Sets the fielddirectoryToZip
.- Specified by:
setDirectoryToZip
in interfaceZipModel
- Parameters:
directoryToZip
- ThedirectoryToZip
to set
-
getDirToStart
public java.lang.String getDirToStart()
Description copied from interface:ZipModel
Returns the fielddirToStart
.- Specified by:
getDirToStart
in interfaceZipModel
- Returns:
- The field
dirToStart
.
-
setDirToStart
public void setDirToStart(java.lang.String dirToStart)
Description copied from interface:ZipModel
Sets the fielddirToStart
.- Specified by:
setDirToStart
in interfaceZipModel
- Parameters:
dirToStart
- ThedirToStart
to set
-
getFileCounter
public int getFileCounter()
Description copied from interface:ZipModel
Returns the fieldfileCounter
.- Specified by:
getFileCounter
in interfaceZipModel
- Returns:
- The field
fileCounter
.
-
setFileCounter
public void setFileCounter(int fileCounter)
Description copied from interface:ZipModel
Sets the fieldfileCounter
.- Specified by:
setFileCounter
in interfaceZipModel
- Parameters:
fileCounter
- ThefileCounter
to set
-
getFileFilter
public java.io.FilenameFilter getFileFilter()
Description copied from interface:ZipModel
Returns the fieldfileFilter
.- Specified by:
getFileFilter
in interfaceZipModel
- Returns:
- The field
fileFilter
.
-
setFileFilter
public void setFileFilter(java.io.FilenameFilter fileFilter)
Description copied from interface:ZipModel
Sets the fieldfileFilter
.- Specified by:
setFileFilter
in interfaceZipModel
- Parameters:
fileFilter
- ThefileFilter
to set
-
getFileLength
public long getFileLength()
Description copied from interface:ZipModel
Returns the fieldfileLength
.- Specified by:
getFileLength
in interfaceZipModel
- Returns:
- The field
fileLength
.
-
setFileLength
public void setFileLength(long fileLength)
Description copied from interface:ZipModel
Sets the fieldfileLength
.- Specified by:
setFileLength
in interfaceZipModel
- Parameters:
fileLength
- ThefileLength
to set
-
getZipFile
public java.io.File getZipFile()
Description copied from interface:ZipModel
Returns the fieldzipFile
.- Specified by:
getZipFile
in interfaceZipModel
- Returns:
- The field
zipFile
.
-
setZipFile
public void setZipFile(java.io.File zipFile)
Description copied from interface:ZipModel
Sets the fieldzipFile
.- Specified by:
setZipFile
in interfaceZipModel
- Parameters:
zipFile
- ThezipFile
to set
-
getZipFileComment
public java.lang.String getZipFileComment()
Description copied from interface:ZipModel
Returns the fieldzipFileComment
.- Specified by:
getZipFileComment
in interfaceZipModel
- Returns:
- The field
zipFileComment
.
-
setZipFileComment
public void setZipFileComment(java.lang.String zipFileComment)
Description copied from interface:ZipModel
Sets the fieldzipFileComment
.- Specified by:
setZipFileComment
in interfaceZipModel
- Parameters:
zipFileComment
- ThezipFileComment
to set
-
getZipFileName
public java.lang.String getZipFileName()
Description copied from interface:ZipModel
Returns the fieldzipFileName
.- Specified by:
getZipFileName
in interfaceZipModel
- Returns:
- The field
zipFileName
.
-
setZipFileName
public void setZipFileName(java.lang.String zipFileName)
Description copied from interface:ZipModel
Sets the fieldzipFileName
.- Specified by:
setZipFileName
in interfaceZipModel
- Parameters:
zipFileName
- ThezipFileName
to set
-
getZipFileObj
public java.util.zip.ZipFile getZipFileObj()
Description copied from interface:ZipModel
Returns the fieldzipFileObj
.- Specified by:
getZipFileObj
in interfaceZipModel
- Returns:
- The field
zipFileObj
.
-
setZipFileObj
public void setZipFileObj(java.util.zip.ZipFile zipFileObj)
Description copied from interface:ZipModel
Sets the fieldzipFileObj
.- Specified by:
setZipFileObj
in interfaceZipModel
- Parameters:
zipFileObj
- ThezipFileObj
to set
-
getZipLevel
public int getZipLevel()
Description copied from interface:ZipModel
Returns the fieldzipLevel
.- Specified by:
getZipLevel
in interfaceZipModel
- Returns:
- The field
zipLevel
.
-
setZipLevel
public void setZipLevel(int zipLevel)
Description copied from interface:ZipModel
Sets the fieldzipLevel
.- Specified by:
setZipLevel
in interfaceZipModel
- Parameters:
zipLevel
- ThezipLevel
to set
-
toBuilder
public Zipper.ZipperBuilder toBuilder()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
zip
public java.util.Optional<ZipErrorCodes> zip()
Zip the given files of this object- Returns:
- the optional with the possibles errors
-
-