private static void writeToStream(TarOutputStream pOut, File pFolder,
			String pParent, List<String> pIgnores) throws IOException {
		File[] filesToTar = pFolder.listFiles(new FileFilter() {
			public boolean accept(File pArg0) {
				return pArg0.isFile();
			}
		});

		if (filesToTar != null) {
			for (File f : filesToTar) {
				String path = pParent + "/" + f.getName();
				boolean skip = shouldSkip(pIgnores, path);
				if (!skip) {
					pOut.putNextEntry(new TarEntry(f, path));
					BufferedInputStream origin = new BufferedInputStream(
							new FileInputStream(f));
					int count;
					byte data[] = new byte[2048];

					while ((count = origin.read(data)) != -1) {
						pOut.write(data, 0, count);
					}

					pOut.flush();
					origin.close();
				}
			}
		}

		File[] dirsToTar = pFolder.listFiles(new FileFilter() {
			public boolean accept(File pArg0) {
				return pArg0.isDirectory();
			}
		});

		if (dirsToTar != null) {
			for (File dir : dirsToTar) {

				String path = pParent + "/" + dir.getName();
				boolean skip = shouldSkip(pIgnores, path);
				if (!skip) {
					pOut.putNextEntry(new TarEntry(dir, path));
					writeToStream(pOut, dir, path, pIgnores);
				}
			}
		}

	}