// Create an entry for the file
if(!dir.equals("."))
if(File.separator.equals("\\")){
dir = dir.replaceAll("\\\\", "/");
}
taos.putArchiveEntry(new TarArchiveEntry(file, dir + "/" + file.getName()));
if (file.isFile()) {
// Add the file to the archive
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
IOUtils.copy(new FileInputStream(file), taos);
taos.closeArchiveEntry();