This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 6529f6102dc924495295cb7260a153d75386c540 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Aug 8 17:48:03 2020 -0400 Add LinkOptions to SevenZOutputFile.createArchiveEntry(). --- src/changes/changes.xml | 2 +- .../commons/compress/archivers/sevenz/SevenZOutputFile.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 670b4e5..f962f95 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -137,7 +137,7 @@ The <action> type attribute can be add,update,fix,remove. Add SevenZOutputFile.write(Path, OpenOption...). </action> <action type="update" date="2020-08-08" due-to="Gary Gregory" dev="ggregory"> - Add SevenZOutputFile.createArchiveEntry(Path, String). + Add SevenZOutputFile.createArchiveEntry(Path, String, LinkOption...). </action> <action type="update" date="2020-08-08" due-to="Gary Gregory" dev="ggregory"> Add ArArchiveOutputStream.createArchiveEntry(Path, String, LinkOption...). diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java index 3485e1f..e09542c 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java @@ -31,6 +31,7 @@ import java.nio.ByteOrder; import java.nio.channels.SeekableByteChannel; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.LinkOption; import java.nio.file.OpenOption; import java.nio.file.Path; import java.nio.file.StandardOpenOption; @@ -167,17 +168,18 @@ public class SevenZOutputFile implements Closeable { * * @param inputPath path to create an entry from * @param entryName the name to use + * @param options options indicating how symbolic links are handled. * @return the ArchiveEntry set up with details from the file * * @throws IOException on error * @since 1.21 */ public SevenZArchiveEntry createArchiveEntry(final Path inputPath, - final String entryName) throws IOException { + final String entryName, LinkOption... options) throws IOException { final SevenZArchiveEntry entry = new SevenZArchiveEntry(); - entry.setDirectory(Files.isDirectory(inputPath)); + entry.setDirectory(Files.isDirectory(inputPath, options)); entry.setName(entryName); - entry.setLastModifiedDate(new Date(Files.getLastModifiedTime(inputPath).toMillis())); + entry.setLastModifiedDate(new Date(Files.getLastModifiedTime(inputPath, options).toMillis())); return entry; }