/** * @return the group name for the tar entry */ public String getGroup() { if (isReference()) { return getCheckedRef().getGroup(); } checkEntry(); return groupName; }
/** * @return the user name for the tar entry */ public String getUserName() { if (isReference()) { return getCheckedRef().getUserName(); } checkEntry(); return userName; }
/** * @return the gid for the tar entry * @since 1.10.4 */ public long getLongGid() { if (isReference()) { return getCheckedRef().getLongGid(); } checkEntry(); return gid; }
/** * @return the uid for the tar entry * @since 1.10.4 */ public long getLongUid() { if (isReference()) { return getCheckedRef().getLongUid(); } checkEntry(); return uid; }
org.apache.tools.ant.types.resources.TarResource tr = (org.apache.tools.ant.types.resources.TarResource) r; return new ResourceFlags(tr.getMode(), tr.getUid(), tr.getGid(), tr.getUserName(), tr.getGroup()); } else if (r instanceof org.apache.tools.ant.types.resources.ZipResource) {
/** * Return an InputStream for reading the contents of this Resource. * @return an InputStream object. * @throws IOException if the tar file cannot be opened, * or the entry cannot be read. */ @Override public InputStream getInputStream() throws IOException { if (isReference()) { return getCheckedRef().getInputStream(); } Resource archive = getArchive(); final TarInputStream i = new TarInputStream(archive.getInputStream()); TarEntry te; while ((te = i.getNextEntry()) != null) { if (te.getName().equals(getName())) { return i; } } FileUtils.close(i); throw new BuildException("no entry " + getName() + " in " + getArchive()); }
/** * fetches information from the named entry inside the archive. */ @Override protected void fetchEntry() { Resource archive = getArchive(); try (TarInputStream i = new TarInputStream(archive.getInputStream())) { TarEntry te = null; while ((te = i.getNextEntry()) != null) { if (te.getName().equals(getName())) { setEntry(te); return; } } } catch (IOException e) { log(e.getMessage(), Project.MSG_DEBUG); throw new BuildException(e); } setEntry(null); }
if (r instanceof TarResource) { final TarResource tr = (TarResource) r; te.setUserName(tr.getUserName()); te.setUserId(tr.getLongUid()); te.setGroupName(tr.getGroup()); te.setGroupId(tr.getLongGid());
/** * Get an OutputStream for the Resource. * @return an OutputStream to which content can be written. * @throws IOException if unable to provide the content of this * Resource as a stream. * @throws UnsupportedOperationException if OutputStreams are not * supported for this Resource type. */ @Override public OutputStream getOutputStream() throws IOException { if (isReference()) { return getCheckedRef().getOutputStream(); } throw new UnsupportedOperationException( "Use the tar task for tar output."); }
@Override public boolean eval() throws BuildException { validate(); String actual = ccResource != null ? ccResource.getUserName() : antResource.getUserName(); log("expected: " + name + ", actual: " + actual, Project.MSG_VERBOSE); return name.equals(actual); } }
@Override public boolean eval() throws BuildException { validate(); String actual = ccResource != null ? ccResource.getGroup() : antResource.getGroup(); log("expected: " + name + ", actual: " + actual, Project.MSG_VERBOSE); return name.equals(actual); } }
TarEntry entry = null; while ((entry = ti.getNextEntry()) != null) { Resource r = new TarResource(src, entry); String name = entry.getName(); if (entry.isDirectory()) {
@Override public boolean eval() throws BuildException { validate(); int actual = ccResource != null ? ccResource.getGid() : antResource.getGid(); log("expected: " + id + ", actual: " + actual, Project.MSG_VERBOSE); return id == actual; } }
/** * @return the uid for the tar entry */ @Deprecated public int getUid() { return (int) getLongUid(); }
/** * @return the uid for the tar entry */ @Deprecated public int getGid() { return (int) getLongGid(); }