public void produce(final DataConsumer pReceiver) throws IOException {
    String user = "******";
    int uid = 0;
    String group = "root";
    int gid = 0;
    int filemode = TarEntry.DEFAULT_FILE_MODE;
    int dirmode = TarEntry.DEFAULT_DIR_MODE;
    String prefix = "";

    if (fileset instanceof Tar.TarFileSet) {
      Tar.TarFileSet tarfileset = (Tar.TarFileSet) fileset;
      user = tarfileset.getUserName();
      uid = tarfileset.getUid();
      group = tarfileset.getGroup();
      gid = tarfileset.getGid();
      filemode = tarfileset.getMode();
      dirmode = tarfileset.getDirMode(tarfileset.getProject());
      prefix = tarfileset.getPrefix(tarfileset.getProject());
    }

    final DirectoryScanner scanner = fileset.getDirectoryScanner(fileset.getProject());
    scanner.scan();

    final File basedir = scanner.getBasedir();

    final String[] directories = scanner.getIncludedDirectories();
    for (int i = 0; i < directories.length; i++) {
      final String name = directories[i].replace('\\', '/');

      pReceiver.onEachDir(prefix + "/" + name, null, user, uid, group, gid, dirmode, 0);
    }

    final String[] files = scanner.getIncludedFiles();
    for (int i = 0; i < files.length; i++) {
      final String name = files[i].replace('\\', '/');
      final File file = new File(basedir, name);

      final InputStream inputStream = new FileInputStream(file);
      try {
        pReceiver.onEachFile(
            inputStream, prefix + "/" + name, null, user, uid, group, gid, filemode, file.length());
      } finally {
        inputStream.close();
      }
    }
  }
  public void produce(final DataConsumer pReceiver) throws IOException {
    String user = Producers.ROOT_NAME;
    int uid = Producers.ROOT_UID;
    String group = Producers.ROOT_NAME;
    int gid = Producers.ROOT_UID;
    int filemode = TarEntry.DEFAULT_FILE_MODE;
    int dirmode = TarEntry.DEFAULT_DIR_MODE;
    String prefix = "";

    if (fileset instanceof Tar.TarFileSet) {
      Tar.TarFileSet tarfileset = (Tar.TarFileSet) fileset;
      user = tarfileset.getUserName();
      uid = tarfileset.getUid();
      group = tarfileset.getGroup();
      gid = tarfileset.getGid();
      filemode = tarfileset.getMode();
      dirmode = tarfileset.getDirMode(tarfileset.getProject());
      prefix = tarfileset.getPrefix(tarfileset.getProject());
    }

    final DirectoryScanner scanner = fileset.getDirectoryScanner(fileset.getProject());
    scanner.scan();

    final File basedir = scanner.getBasedir();

    for (String directory : scanner.getIncludedDirectories()) {
      String name = directory.replace('\\', '/');

      final TarArchiveEntry entry = new TarArchiveEntry(prefix + "/" + name);
      entry.setUserName(user);
      entry.setUserId(uid);
      entry.setGroupName(group);
      entry.setGroupId(gid);
      entry.setMode(dirmode);

      pReceiver.onEachDir(entry);
    }

    for (String filename : scanner.getIncludedFiles()) {
      final String name = filename.replace('\\', '/');
      final File file = new File(basedir, name);

      final InputStream inputStream = new FileInputStream(file);
      try {
        final String entryName = prefix + "/" + name;

        final File entryPath = new File(entryName);

        final boolean symbolicLink = SymlinkUtils.isSymbolicLink(entryPath);
        final TarArchiveEntry e;
        if (symbolicLink) {
          e = new TarArchiveEntry(entryName, TarConstants.LF_SYMLINK);
          e.setLinkName(SymlinkUtils.readSymbolicLink(entryPath));
        } else {
          e = new TarArchiveEntry(entryName, true);
        }

        e.setUserId(uid);
        e.setGroupId(gid);
        e.setUserName(user);
        e.setGroupName(group);
        e.setMode(filemode);
        e.setSize(file.length());

        pReceiver.onEachFile(inputStream, e);
      } finally {
        inputStream.close();
      }
    }
  }