Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Apache Ant Source Code Files
Apache Ant Source Code Files are inside the Apache Ant source package file
like apache-ant-1.10.10-src.zip.
Unzip the source package file and go to the "src/main" sub-directory,
you will see source code files.
Here is the list of Java source code files of the Apache Ant 1.10.10 in \Users\fyicenter\apache-ant-1.10.10\src\main:
✍: FYIcenter.com
⏎ org/apache/tools/ant/types/resources/TarResource.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.tools.ant.types.resources;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarInputStream;
/**
* A Resource representation of an entry in a tar archive.
* @since Ant 1.7
*/
public class TarResource extends ArchiveResource {
private String userName = "";
private String groupName = "";
private long uid;
private long gid;
/**
* Default constructor.
*/
public TarResource() {
}
/**
* Construct a TarResource representing the specified
* entry in the specified archive.
* @param a the archive as File.
* @param e the TarEntry.
*/
public TarResource(File a, TarEntry e) {
super(a, true);
setEntry(e);
}
/**
* Construct a TarResource representing the specified
* entry in the specified archive.
* @param a the archive as Resource.
* @param e the TarEntry.
*/
public TarResource(Resource a, TarEntry e) {
super(a, true);
setEntry(e);
}
/**
* 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 getRef().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());
}
/**
* 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 getRef().getOutputStream();
}
throw new UnsupportedOperationException(
"Use the tar task for tar output.");
}
/**
* @return the user name for the tar entry
*/
public String getUserName() {
if (isReference()) {
return getRef().getUserName();
}
checkEntry();
return userName;
}
/**
* @return the group name for the tar entry
*/
public String getGroup() {
if (isReference()) {
return getRef().getGroup();
}
checkEntry();
return groupName;
}
/**
* @return the uid for the tar entry
* @since 1.10.4
*/
public long getLongUid() {
if (isReference()) {
return getRef().getLongUid();
}
checkEntry();
return uid;
}
/**
* @return the uid for the tar entry
*/
@Deprecated
public int getUid() {
return (int) getLongUid();
}
/**
* @return the gid for the tar entry
* @since 1.10.4
*/
public long getLongGid() {
if (isReference()) {
return getRef().getLongGid();
}
checkEntry();
return gid;
}
/**
* @return the uid for the tar entry
*/
@Deprecated
public int getGid() {
return (int) getLongGid();
}
/**
* 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);
}
@Override
protected TarResource getRef() {
return getCheckedRef(TarResource.class);
}
private void setEntry(TarEntry e) {
if (e == null) {
setExists(false);
return;
}
setName(e.getName());
setExists(true);
setLastModified(e.getModTime().getTime());
setDirectory(e.isDirectory());
setSize(e.getSize());
setMode(e.getMode());
userName = e.getUserName();
groupName = e.getGroupName();
uid = e.getLongUserId();
gid = e.getLongGroupId();
}
}
⏎ org/apache/tools/ant/types/resources/TarResource.java
Or download all of them as a single archive file:
File name: apache-ant-1.10.10-fyi.zip File size: 2392938 bytes Release date: 2021-04-17 Download
⇐ Download Apache Ant Source Package
2021-07-10, ≈396🔥, 0💬
Popular Posts:
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
maven-settings-builder-3 .8.6.jaris the JAR file for Apache Maven 3.8.6 Settings Builder module. Apa...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...
What Is commons-net-ftp-2.0.jar? commons-net-ftp-2.0.jar is the JAR file for Apache Commons Net FTP ...
What Is log4j-1.2.13.jar? I got the JAR file from logging-log4j-1.2.13.zip .log4j-1.2.13.jar is the ...