pex.setSize(data.length); putNextEntry(pex); write(data);
new TarEntry(TarConstants.GNU_LONGLINK, linkType); longLinkEntry.setSize(len + 1); // +1 for NUL transferModTime(entry, longLinkEntry); putNextEntry(longLinkEntry);
break; case "size": currEntry.setSize(Long.parseLong(val)); break; case "mtime":
longLinkEntry.setSize(name.length + 1); putNextEntry(longLinkEntry); write(name);
+ TarConstants.MAXSIZE + " bytes."); te.setSize(r.getSize());
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); }
public void visit(File file, String relativePath) throws IOException { if(Functions.isWindows()) relativePath = relativePath.replace('\\','/'); if(file.isDirectory()) relativePath+='/'; TarEntry te = new TarEntry(relativePath); te.setModTime(file.lastModified()); if(!file.isDirectory()) te.setSize(file.length()); tar.putNextEntry(te); if (!file.isDirectory()) { FileInputStream in = new FileInputStream(file); try { int len; while((len=in.read(buf))>=0) tar.write(buf,0,len); } finally { in.close(); } } tar.closeEntry(); entriesWritten++; }
public void visit(File file, String relativePath) throws IOException { if(Functions.isWindows()) relativePath = relativePath.replace('\\','/'); if(file.isDirectory()) relativePath+='/'; TarEntry te = new TarEntry(relativePath); te.setModTime(file.lastModified()); if(!file.isDirectory()) te.setSize(file.length()); tar.putNextEntry(te); if (!file.isDirectory()) { FileInputStream in = new FileInputStream(file); try { int len; while((len=in.read(buf))>=0) tar.write(buf,0,len); } finally { in.close(); } } tar.closeEntry(); entriesWritten++; }
public void visit(File file, String relativePath) throws IOException { if (Functions.isWindows()) { relativePath = relativePath.replace('\\', '/'); } if (file.isDirectory()) { relativePath += '/'; } TarEntry te = new TarEntry(relativePath); te.setModTime(file.lastModified()); if (!file.isDirectory()) { te.setSize(file.length()); } tar.putNextEntry(te); if (!file.isDirectory()) { FileInputStream in = new FileInputStream(file); try { int len; while ((len = in.read(buf)) >= 0) { tar.write(buf, 0, len); } } finally { in.close(); } } tar.closeEntry(); entriesWritten++; }
public void visit(File file, String relativePath) throws IOException { if(Functions.isWindows()) relativePath = relativePath.replace('\\','/'); if(file.isDirectory()) relativePath+='/'; TarEntry te = new TarEntry(relativePath); te.setModTime(file.lastModified()); if(!file.isDirectory()) te.setSize(file.length()); tar.putNextEntry(te); if (!file.isDirectory()) { FileInputStream in = new FileInputStream(file); try { int len; while((len=in.read(buf))>=0) tar.write(buf,0,len); } finally { in.close(); } } tar.closeEntry(); entriesWritten++; }
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(); } }
entry.setSize(srcFile.length());
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); } }
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(); }
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(); }
longLinkEntry.setSize(name.length + 1); putNextEntry(longLinkEntry); write(name);
longLinkEntry.setSize(name.length + 1); putNextEntry(longLinkEntry); write(name);
longLinkEntry.setSize(name.length + 1); putNextEntry(longLinkEntry); write(name);
TarEntry te = new TarEntry("/bar/foo"); byte[] data = "some-content".getBytes("UTF-8"); te.setSize(data.length); tos.putNextEntry(te); tos.write(data);
TarEntry te = new TarEntry("/bar/foo"); byte[] data = "some-content".getBytes("UTF-8"); te.setSize(data.length); tos.putNextEntry(te); tos.write(data);