Browse Source

provide access to encoding stuff in unzip, hide it in untar

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@799730 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
37d7a6b679
2 changed files with 49 additions and 1 deletions
  1. +37
    -0
      src/main/org/apache/tools/ant/taskdefs/Expand.java
  2. +12
    -1
      src/main/org/apache/tools/ant/taskdefs/Untar.java

+ 37
- 0
src/main/org/apache/tools/ant/taskdefs/Expand.java View File

@@ -439,12 +439,30 @@ public class Expand extends Task {
* @since Ant 1.6 * @since Ant 1.6
*/ */
public void setEncoding(String encoding) { public void setEncoding(String encoding) {
internalSetEncoding(encoding);
}

/**
* Supports grand-children that want to support the attribute
* where the child-class doesn't (i.e. Unzip in the compress
* Antlib).
*
* @since Ant 1.8.0
*/
protected void internalSetEncoding(String encoding) {
if (NATIVE_ENCODING.equals(encoding)) { if (NATIVE_ENCODING.equals(encoding)) {
encoding = null; encoding = null;
} }
this.encoding = encoding; this.encoding = encoding;
} }


/**
* @since Ant 1.8.0
*/
public String getEncoding() {
return encoding;
}

/** /**
* Whether leading path separators should be stripped. * Whether leading path separators should be stripped.
* *
@@ -460,6 +478,25 @@ public class Expand extends Task {
* @since Ant 1.8.0 * @since Ant 1.8.0
*/ */
public void setScanForUnicodeExtraFields(boolean b) { public void setScanForUnicodeExtraFields(boolean b) {
internalSetScanForUnicodeExtraFields(b);
}

/**
* Supports grand-children that want to support the attribute
* where the child-class doesn't (i.e. Unzip in the compress
* Antlib).
*
* @since Ant 1.8.0
*/
protected void internalSetScanForUnicodeExtraFields(boolean b) {
scanForUnicodeExtraFields = b; scanForUnicodeExtraFields = b;
} }

/**
* @since Ant 1.8.0
*/
public boolean getScanForUnicodeExtraFields() {
return scanForUnicodeExtraFields;
}

} }

+ 12
- 1
src/main/org/apache/tools/ant/taskdefs/Untar.java View File

@@ -42,7 +42,7 @@ import org.apache.tools.tar.TarInputStream;
* <p>PatternSets are used to select files to extract * <p>PatternSets are used to select files to extract
* <I>from</I> the archive. If no patternset is used, all files are extracted. * <I>from</I> the archive. If no patternset is used, all files are extracted.
* </p> * </p>
* <p>FileSet>s may be used to select archived files
* <p>FileSets may be used to select archived files
* to perform unarchival upon. * to perform unarchival upon.
* </p> * </p>
* <p>File permissions will not be restored on extracted files.</p> * <p>File permissions will not be restored on extracted files.</p>
@@ -86,6 +86,17 @@ public class Untar extends Expand {
+ " attribute", getLocation()); + " attribute", getLocation());
} }


/**
* No unicode extra fields in tar.
*
* @since Ant 1.8.0
*/
public void setScanForUnicodeExtraFields(boolean b) {
throw new BuildException("The " + getTaskName()
+ " task doesn't support the encoding"
+ " attribute", getLocation());
}

/** /**
* @see Expand#expandFile(FileUtils, File, File) * @see Expand#expandFile(FileUtils, File, File)
*/ */


Loading…
Cancel
Save