putNextEntry(pex); write(data); closeEntry();
write(encodedName.array(), encodedName.arrayOffset(), len); write(0); // NUL terminator closeEntry(); } else if (longFileMode != LONGFILE_TRUNCATE) { throw new RuntimeException(fieldName + " '" + name //NOSONAR
tOut.closeEntry(); } finally { FileUtils.close(in);
public void storeRecord(String path, InputStream data, long size) throws IOException { path = path.replaceAll("/+", "/").replace("\\", "/"); if(exportedFiles.contains(path)) { log.debug(String.format("Skipping already stored entry '%s'", path)); return; } TarEntry ze = new TarEntry(path); ze.setSize(size); outputStream.putNextEntry(ze); copyStream(data, outputStream, true, false); outputStream.closeEntry(); exportedFiles.add(path); }
private void addFile (TarEntry entry, TarOutputStream tar_out, InputStream in, long size, byte[] buf) throws IOException { entry.setModTime(System.currentTimeMillis()); entry.setSize(size); tar_out.putNextEntry(entry); FileUtil.copyStream(in, tar_out, buf); tar_out.closeEntry(); } }
private void visitDir(FileCopyDetails dirDetails) { try { // Trailing slash on name indicates entry is a directory TarEntry archiveEntry = new TarEntry(dirDetails.getRelativePath().getPathString() + '/'); archiveEntry.setModTime(getArchiveTimeFor(dirDetails)); archiveEntry.setMode(UnixStat.DIR_FLAG | dirDetails.getMode()); tarOutStr.putNextEntry(archiveEntry); tarOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to TAR '%s'.", dirDetails, tarFile), e); } } }
private void visitFile(FileCopyDetails fileDetails) { try { TarEntry archiveEntry = new TarEntry(fileDetails.getRelativePath().getPathString()); archiveEntry.setModTime(getArchiveTimeFor(fileDetails)); archiveEntry.setSize(fileDetails.getSize()); archiveEntry.setMode(UnixStat.FILE_FLAG | fileDetails.getMode()); tarOutStr.putNextEntry(archiveEntry); fileDetails.copyTo(tarOutStr); tarOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to TAR '%s'.", fileDetails, tarFile), e); } }
FileUtil.copyStream(tar_in, tar_out, buf); tar_out.closeEntry();
protected int putFileContent(Launcher launcher, String containerId, String path, String filename, byte[] content, Integer mode) throws IOException, InterruptedException { TarEntry entry = new TarEntry(filename); entry.setUserId(0); entry.setGroupId(0); entry.setSize(content.length); if (mode != null) { entry.setMode(mode); } ByteArrayOutputStream out = new ByteArrayOutputStream(); TarOutputStream tar = new TarOutputStream(out); tar.putNextEntry(entry); tar.write(content); tar.closeEntry(); tar.close(); ArgumentListBuilder args = new ArgumentListBuilder() .add("cp", "-", containerId + ":" + path); return launchDockerCLI(launcher, args) .stdin(new ByteArrayInputStream(out.toByteArray())) .stderr(launcher.getListener().getLogger()).join(); }
tos.putNextEntry(te); tos.write(data); tos.closeEntry(); tos.flush(); tos.finish();
tos.putNextEntry(te); tos.write(data); tos.closeEntry(); tos.flush(); tos.finish();