void addFile(ZipOutputStream zos,File file) throws IOException {
  String name=file.getPath();
  boolean isDir=file.isDirectory();
  if (isDir) {
    name=name.endsWith(File.separator) ? name : (name + File.separator);
  }
  name=entryName(name);
  if (name.equals("") || name.equals(".") || name.equals(zname)) {
    return;
  }
 else   if ((name.equals(MANIFEST_DIR) || name.equals(MANIFEST_NAME)) && !Mflag) {
    if (vflag) {
      output(formatMsg("out.ignore.entry",name));
    }
    return;
  }
  long size=isDir ? 0 : file.length();
  if (vflag) {
    out.print(formatMsg("out.adding",name));
  }
  ZipEntry e=new ZipEntry(name);
  e.setTime(file.lastModified());
  if (size == 0) {
    e.setMethod(ZipEntry.STORED);
    e.setSize(0);
    e.setCrc(0);
  }
 else   if (flag0) {
    crc32File(e,file);
  }
  zos.putNextEntry(e);
  if (!isDir) {
    copy(file,zos);
  }
  zos.closeEntry();
  if (vflag) {
    size=e.getSize();
    long csize=e.getCompressedSize();
    out.print(formatMsg2("out.size",String.valueOf(size),String.valueOf(csize)));
    if (e.getMethod() == ZipEntry.DEFLATED) {
      long ratio=0;
      if (size != 0) {
        ratio=((size - csize) * 100) / size;
      }
      output(formatMsg("out.deflated",String.valueOf(ratio)));
    }
 else {
      output(getMsg("out.stored"));
    }
  }
}

void addFile ( ZipOutputStream zos , File file ) throws IOException { String name = file . getPath ( ) ; boolean isDir = file . isDirectory ( ) ; if ( isDir ) { name = name . endsWith ( File . separator ) ? name : ( name + File . separator ) ; } name = entryName ( name ) ; if ( name . equals ( "" ) || name . equals ( "." ) || name . equals ( zname ) ) { return ; } else if ( ( name . equals ( MANIFEST_DIR ) || name . equals ( MANIFEST_NAME ) ) && ! Mflag ) { if ( vflag ) { output ( formatMsg ( "out.ignore.entry" , name ) ) ; } return ; } long size = isDir ? 0 : file . length ( ) ; if ( vflag ) { out . print ( formatMsg ( "out.adding" , name ) ) ; } ZipEntry e = new ZipEntry ( name ) ; e . setTime ( file . lastModified ( ) ) ; if ( size == 0 ) { e . setMethod ( ZipEntry . STORED ) ; e . setSize ( 0 ) ; e . setCrc ( 0 ) ; } else if ( flag0 ) { crc32File ( e , file ) ; } zos . putNextEntry ( e ) ; if ( ! isDir ) { copy ( file , zos ) ; } zos . closeEntry ( ) ; if ( vflag ) { size = e . getSize ( ) ; long csize = e . getCompressedSize ( ) ; out . print ( formatMsg2 ( "out.size" , String . valueOf ( size ) , String . valueOf ( csize ) ) ) ; if ( e . getMethod ( ) == ZipEntry . DEFLATED ) { long ratio = 0 ; if ( size != 0 ) { ratio = ( ( size - csize ) * 100 ) / size ; } output ( formatMsg ( "out.deflated" , String . valueOf ( ratio ) ) ) ; } else { output ( getMsg ( "out.stored" ) ) ; } } }
adds a new file entry to the zip output stream .
