public Optional<ZipErrorCodes> zip()
	{
		try (FileOutputStream fos = new FileOutputStream(this.zipFile);
			ZipOutputStream zos = new ZipOutputStream(fos);)
		{

			if (!this.directoryToZip.exists())
			{
				return Optional.of(ZipErrorCodes.DIRECTORY_TO_ZIP_DOES_NOT_EXIST);
			}
			if (!this.zipFile.exists())
			{
				return Optional.of(ZipErrorCodes.ZIP_FILE_DOES_NOT_EXIST);
			}
			if (0 < this.zipLevel)
			{
				zos.setLevel(this.zipLevel);
			}
			else
			{
				zos.setLevel(9);
			}
			if (null != this.zipFileComment)
			{
				zos.setComment(this.zipFileComment);
			}
			if (0 < this.compressionMethod)
			{
				zos.setMethod(this.compressionMethod);
			}
			this.zipFiles(this.directoryToZip, zos);
			zos.flush();
			zos.finish();
			fos.flush();
		}
		catch (IOException e)
		{
			log.log(Level.SEVERE, e.getLocalizedMessage(), e);
			return Optional.of(ZipErrorCodes.IO_ERROR);
		}
		return Optional.empty();
	}
public Optional < ZipErrorCodes > zip ( ) { try ( FileOutputStream fos = new FileOutputStream ( this . zipFile ) ; ZipOutputStream zos = new ZipOutputStream ( fos ) ; ) { if ( ! this . directoryToZip . exists ( ) ) { return Optional . of ( ZipErrorCodes . DIRECTORY_TO_ZIP_DOES_NOT_EXIST ) ; } if ( ! this . zipFile . exists ( ) ) { return Optional . of ( ZipErrorCodes . ZIP_FILE_DOES_NOT_EXIST ) ; } if ( 0 < this . zipLevel ) { zos . setLevel ( this . zipLevel ) ; } else { zos . setLevel ( 9 ) ; } if ( null != this . zipFileComment ) { zos . setComment ( this . zipFileComment ) ; } if ( 0 < this . compressionMethod ) { zos . setMethod ( this . compressionMethod ) ; } this . zipFiles ( this . directoryToZip , zos ) ; zos . flush ( ) ; zos . finish ( ) ; fos . flush ( ) ; } catch ( IOException e ) { log . log ( Level . SEVERE , e . getLocalizedMessage ( ) , e ) ; return Optional . of ( ZipErrorCodes . IO_ERROR ) ; } return Optional . empty ( ) ; }
Zip the given files of this objects

@return the optional with the possibles errors