[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-08 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=355810=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-355810
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 08/Dec/19 13:31
Start Date: 08/Dec/19 13:31
Worklog Time Spent: 10m 
  Work Description: asfgit commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 355810)
Time Spent: 10h 50m  (was: 10h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 10h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-08 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=355807=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-355807
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 08/Dec/19 12:27
Start Date: 08/Dec/19 12:27
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-562942818
 
 
   @PeterAlfreadLee I'll merge this PR and perform some minor changes that I'd 
ask you to look at once I've pushed things.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 355807)
Time Spent: 10h 40m  (was: 10.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 10h 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-08 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=355804=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-355804
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 08/Dec/19 12:22
Start Date: 08/Dec/19 12:22
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r355182326
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
 ##
 @@ -195,7 +212,7 @@ public synchronized SeekableByteChannel position(long 
newPosition) throws IOExce
  * @throws NullPointerException if channels is null
  * @return SeekableByteChannel that concatenates all provided channels
  */
-public static SeekableByteChannel 
forSeekableByteChannels(SeekableByteChannel... channels) {
+public static SeekableByteChannel 
forSeekableByteChannels(SeekableByteChannel... channels) throws IOException {
 
 Review comment:
   this is an API breaking change.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 355804)
Time Spent: 10.5h  (was: 10h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 10.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-05 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354302=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354302
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 13:56
Start Date: 05/Dec/19 13:56
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545874938
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/27435814/badge)](https://coveralls.io/builds/27435814)
   
   Coverage increased (+0.2%) to 86.897% when pulling 
**0df4d084182c2c2662b777ee2c3b04a1c42bbc66 on PeterAlfreadLee:COMPRESS_477** 
into **28049d2f89a76c5a4845c12151a483ca7773fb6f on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354302)
Time Spent: 10h 20m  (was: 10h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 10h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-05 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354297=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354297
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 13:35
Start Date: 05/Dec/19 13:35
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-562130678
 
 
   Code just pushed.
   I have added a new parameter `skipSplitSig` in constructor of 
`ZipArchiveInputStream`. By default it's set to be false. I'm not sure if the 
naming and the default value are good or not. What do you think? @bodewig 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354297)
Time Spent: 10h 10m  (was: 10h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 10h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-05 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354279=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354279
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 13:05
Start Date: 05/Dec/19 13:05
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #86: COMPRESS-477 building 
a split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-552765671
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/27434842/badge)](https://coveralls.io/builds/27434842)
   
   Coverage increased (+0.08%) to 86.799% when pulling 
**e61d22ee3549e9ac7379114d9e0a40d68b5dc600 on 
PeterAlfreadLee:COMPRESS-477-constructing** into 
**28049d2f89a76c5a4845c12151a483ca7773fb6f on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354279)
Time Spent: 10h  (was: 9h 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 10h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-05 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354278=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354278
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 13:02
Start Date: 05/Dec/19 13:02
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-562119952
 
 
   Code just pushed with all these reviews fixed.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354278)
Time Spent: 9h 50m  (was: 9h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 9h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-05 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354152=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354152
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 09:18
Start Date: 05/Dec/19 09:18
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r354186221
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java
 ##
 @@ -0,0 +1,236 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+public class ZipSplitOutputStream extends OutputStream {
+private OutputStream outputStream;
+private File zipFile;
+private long splitSize;
+private int currentSplitSegmentIndex = 0;
+private long currentSplitSegmentBytesWritten = 0;
+private boolean finished = false;
+
+/**
+ * 8.5.1 Capacities for split archives are as follows:
+ * 
+ * Maximum number of segments = 4,294,967,295 - 1
+ * Maximum .ZIP segment size = 4,294,967,295 bytes (refer to section 8.5.6)
+ * Minimum segment size = 64K
+ * Maximum PKSFX segment size = 2,147,483,647 bytes
+ */
+private final long ZIP_SEGMENT_MIN_SIZE = 64 * 1024L;
+private final long ZIP_SEGMENT_MAX_SIZE = 4294967295L;
+
+/**
+ * Create a split zip. If the zip file is smaller than the split size,
+ * then there will only be one split zip, and its suffix is .zip,
+ * otherwise the split segments should be like .z01, .z02, ... .z(N-1), 
.zip
+ *
+ * @param zipFile   the zip file to write to
+ * @param splitSize the split size
+ */
+public ZipSplitOutputStream(final File zipFile, final long splitSize) 
throws IllegalArgumentException, IOException {
+if (splitSize < ZIP_SEGMENT_MIN_SIZE || splitSize > 
ZIP_SEGMENT_MAX_SIZE) {
+throw new IllegalArgumentException("zip split segment size should 
between 64K and 4,294,967,295");
+}
+
+this.zipFile = zipFile;
+this.splitSize = splitSize;
+
+this.outputStream = new FileOutputStream(zipFile);
+// write the zip split signature 0x08074B50 to the zip file
+writeZipSplitSignature();
+}
+
+/**
+ * Some data can not be written to different split segments, for example:
+ * 
+ * 4.4.1.5  The end of central directory record and the Zip64 end
+ * of central directory locator record MUST reside on the same
+ * disk when splitting or spanning an archive.
+ *
+ * @param unsplittableContentSize
+ * @throws IllegalArgumentException
+ * @throws IOException
+ */
+public void prepareToWriteUnsplittableContent(long 
unsplittableContentSize) throws IllegalArgumentException, IOException {
+if (unsplittableContentSize > this.splitSize) {
+throw new IllegalArgumentException("The unsplittable content size 
is bigger than the split segment size");
+}
+
+long bytesRemainingInThisSegment = this.splitSize - 
this.currentSplitSegmentBytesWritten;
+if (bytesRemainingInThisSegment < unsplittableContentSize) {
+openNewSplitSegment();
+}
+}
+
+@Override
+public void write(int i) throws IOException {
+byte[] b = ByteBuffer.allocate(4).putInt(i).array();
 
 Review comment:
   no worries, that's what a second pair of eyes is good for.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354152)
Time Spent: 9h 40m  (was: 9.5h)

> Support 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-05 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354151=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354151
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 09:17
Start Date: 05/Dec/19 09:17
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354185631
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
 ##
 @@ -367,13 +367,9 @@ public ZipArchiveEntry getNextZipEntry() throws 
IOException {
 private void readFirstLocalFileHeader(final byte[] lfh) throws IOException 
{
 readFully(lfh);
 final ZipLong sig = new ZipLong(lfh);
-if (sig.equals(ZipLong.DD_SIG)) {
 
 Review comment:
   Yes, that's what I meant to say.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354151)
Time Spent: 9.5h  (was: 9h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 9.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354105=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354105
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:33
Start Date: 05/Dec/19 07:33
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545874938
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/27429202/badge)](https://coveralls.io/builds/27429202)
   
   Coverage increased (+0.2%) to 86.894% when pulling 
**2b0775e362a0612b3b708d08dfe920152dbd9656 on PeterAlfreadLee:COMPRESS_477** 
into **28049d2f89a76c5a4845c12151a483ca7773fb6f on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354105)
Time Spent: 9h 20m  (was: 9h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 9h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354098=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354098
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:25
Start Date: 05/Dec/19 07:25
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354143028
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.zip.ZipLong;
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+public class ZipSplitReadOnlySeekableByteChannel extends 
MultiReadOnlySeekableByteChannel {
+protected final int ZIP_SPLIT_SIGNATURE_LENGTH = 4;
+protected ByteBuffer zipSplitSignatureByteBuffer = 
ByteBuffer.allocate(ZIP_SPLIT_SIGNATURE_LENGTH);
+
+/**
+ * Concatenates the given channels.
+ * the channels should be add in ascending order, e.g. z01, z02, ... z99, 
zip
+ * please note that the .zip file is the last segment and should be added 
as the last one in the channels
+ *
+ * The first 4 bytes of split zip signature will be taken into 
consideration by Inflator,
+ * so we don't need to skip them
+ *
+ * @param channels the channels to concatenate
+ * @throws NullPointerException if channels is null
+ */
+public ZipSplitReadOnlySeekableByteChannel(List 
channels) throws IOException {
+super(channels);
+
+// each split zip segment should begin with zip split signature
+validSplitSignature(channels);
+}
+
+/**
+ * the first 4 bytes of zip split segments should be the zip split 
signature(0x08074B50)
+ *
+ * @param channels channels to be valided
+ * @throws IOException
+ */
+private void validSplitSignature(final List channels) 
throws IOException {
+for(int i = 0;i < channels.size();i++) {
+SeekableByteChannel channel = channels.get(i);
+// the zip split file signature is always at the beginning of the 
segment
+channel.position(0L);
+
+channel.read(zipSplitSignatureByteBuffer);
+final ZipLong signature = new 
ZipLong(zipSplitSignatureByteBuffer.array());
+if(!signature.equals(ZipLong.DD_SIG)) {
+channel.position(0L);
+throw new IOException("No." + (i + 1) +  " split zip file is 
not begin with split zip file signature");
+}
+
+channel.position(0L);
+}
+}
+
+/**
+ * set the position based on the given disk number and relative offset
+ *
+ * @param diskNumber the disk number of split zip files
+ * @param relativeOffset the offset in the split zip segment with given 
disk number
+ * @return global position of all split zip files as if they are a single 
channel
+ * @throws IOException
+ */
+public synchronized SeekableByteChannel position(long diskNumber, long 
relativeOffset) throws IOException {
+long globalPosition = relativeOffset;
+for(int i = 0; i < diskNumber;i++) {
+globalPosition += channels.get(i).size();
+}
+
+return position(globalPosition);
+}
+
+/**
+ * Concatenates the given channels.
+ *
+ * @param channels the channels to concatenate, note that the LAST CHANNEL 
of 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354097=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354097
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:25
Start Date: 05/Dec/19 07:25
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354143011
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354097)
Time Spent: 8.5h  (was: 8h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 8.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354099=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354099
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:25
Start Date: 05/Dec/19 07:25
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354143139
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
 ##
 @@ -44,9 +44,9 @@
  */
 public class MultiReadOnlySeekableByteChannel implements SeekableByteChannel {
 
-private final List channels;
-private long globalPosition;
-private int currentChannelIdx;
+protected final List channels;
 
 Review comment:
   This could be private now.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354099)
Time Spent: 8h 50m  (was: 8h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 8h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354101=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354101
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:25
Start Date: 05/Dec/19 07:25
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354143221
 
 

 ##
 File path: src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
 ##
 @@ -143,6 +144,11 @@
  */
 private volatile boolean closed = true;
 
+/**
+ * Whether the zip archive is a splite zip archive
+ */
+private boolean isSplitZipArchive = false;
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354101)
Time Spent: 9h 10m  (was: 9h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 9h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354100=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354100
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:25
Start Date: 05/Dec/19 07:25
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354143177
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.zip.ZipLong;
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+public class ZipSplitReadOnlySeekableByteChannel extends 
MultiReadOnlySeekableByteChannel {
+protected final int ZIP_SPLIT_SIGNATURE_LENGTH = 4;
+protected ByteBuffer zipSplitSignatureByteBuffer = 
ByteBuffer.allocate(ZIP_SPLIT_SIGNATURE_LENGTH);
+
+/**
+ * Concatenates the given channels.
+ * the channels should be add in ascending order, e.g. z01, z02, ... z99, 
zip
+ * please note that the .zip file is the last segment and should be added 
as the last one in the channels
+ *
+ * The first 4 bytes of split zip signature will be taken into 
consideration by Inflator,
+ * so we don't need to skip them
+ *
+ * @param channels the channels to concatenate
+ * @throws NullPointerException if channels is null
+ */
+public ZipSplitReadOnlySeekableByteChannel(List 
channels) throws IOException {
+super(channels);
+
+// each split zip segment should begin with zip split signature
+validSplitSignature(channels);
+}
+
+/**
+ * the first 4 bytes of zip split segments should be the zip split 
signature(0x08074B50)
+ *
+ * @param channels channels to be valided
+ * @throws IOException
+ */
+private void validSplitSignature(final List channels) 
throws IOException {
+for(int i = 0;i < channels.size();i++) {
+SeekableByteChannel channel = channels.get(i);
+// the zip split file signature is always at the beginning of the 
segment
+channel.position(0L);
+
+channel.read(zipSplitSignatureByteBuffer);
+final ZipLong signature = new 
ZipLong(zipSplitSignatureByteBuffer.array());
+if(!signature.equals(ZipLong.DD_SIG)) {
+channel.position(0L);
+throw new IOException("No." + (i + 1) +  " split zip file is 
not begin with split zip file signature");
+}
+
+channel.position(0L);
+}
+}
+
+/**
+ * set the position based on the given disk number and relative offset
+ *
+ * @param diskNumber the disk number of split zip files
+ * @param relativeOffset the offset in the split zip segment with given 
disk number
+ * @return global position of all split zip files as if they are a single 
channel
+ * @throws IOException
+ */
+public synchronized SeekableByteChannel position(long diskNumber, long 
relativeOffset) throws IOException {
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354096=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354096
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:24
Start Date: 05/Dec/19 07:24
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354143001
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitSegmentComparator.java
 ##
 @@ -0,0 +1,45 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.util.Comparator;
+
+public class ZipSplitSegmentComparator implements Comparator {
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354096)
Time Spent: 8h 20m  (was: 8h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 8h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354095=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354095
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:24
Start Date: 05/Dec/19 07:24
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354142987
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.zip.ZipLong;
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+public class ZipSplitReadOnlySeekableByteChannel extends 
MultiReadOnlySeekableByteChannel {
+protected final int ZIP_SPLIT_SIGNATURE_LENGTH = 4;
+protected ByteBuffer zipSplitSignatureByteBuffer = 
ByteBuffer.allocate(ZIP_SPLIT_SIGNATURE_LENGTH);
+
+/**
+ * Concatenates the given channels.
+ * the channels should be add in ascending order, e.g. z01, z02, ... z99, 
zip
+ * please note that the .zip file is the last segment and should be added 
as the last one in the channels
+ *
+ * The first 4 bytes of split zip signature will be taken into 
consideration by Inflator,
+ * so we don't need to skip them
+ *
+ * @param channels the channels to concatenate
+ * @throws NullPointerException if channels is null
+ */
+public ZipSplitReadOnlySeekableByteChannel(List 
channels) throws IOException {
+super(channels);
+
+// each split zip segment should begin with zip split signature
+validSplitSignature(channels);
+}
+
+/**
+ * the first 4 bytes of zip split segments should be the zip split 
signature(0x08074B50)
+ *
+ * @param channels channels to be valided
+ * @throws IOException
+ */
+private void validSplitSignature(final List channels) 
throws IOException {
+for(int i = 0;i < channels.size();i++) {
+SeekableByteChannel channel = channels.get(i);
+// the zip split file signature is always at the beginning of the 
segment
+channel.position(0L);
+
+channel.read(zipSplitSignatureByteBuffer);
+final ZipLong signature = new 
ZipLong(zipSplitSignatureByteBuffer.array());
+if(!signature.equals(ZipLong.DD_SIG)) {
+channel.position(0L);
+throw new IOException("No." + (i + 1) +  " split zip file is 
not begin with split zip file signature");
+}
+
+channel.position(0L);
+}
+}
+
+/**
+ * set the position based on the given disk number and relative offset
+ *
+ * @param diskNumber the disk number of split zip files
+ * @param relativeOffset the offset in the split zip segment with given 
disk number
+ * @return global position of all split zip files as if they are a single 
channel
+ * @throws IOException
+ */
+public synchronized SeekableByteChannel position(long diskNumber, long 
relativeOffset) throws IOException {
+long globalPosition = relativeOffset;
+for(int i = 0; i < diskNumber;i++) {
+globalPosition += channels.get(i).size();
+}
+
+return position(globalPosition);
+}
+
+/**
+ * Concatenates the given channels.
+ *
+ * @param channels the channels to concatenate, note that the LAST CHANNEL 
of 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354093=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354093
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:23
Start Date: 05/Dec/19 07:23
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #86: 
COMPRESS-477 building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r354142521
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java
 ##
 @@ -0,0 +1,236 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+public class ZipSplitOutputStream extends OutputStream {
+private OutputStream outputStream;
+private File zipFile;
+private long splitSize;
+private int currentSplitSegmentIndex = 0;
+private long currentSplitSegmentBytesWritten = 0;
+private boolean finished = false;
+
+/**
+ * 8.5.1 Capacities for split archives are as follows:
+ * 
+ * Maximum number of segments = 4,294,967,295 - 1
+ * Maximum .ZIP segment size = 4,294,967,295 bytes (refer to section 8.5.6)
+ * Minimum segment size = 64K
+ * Maximum PKSFX segment size = 2,147,483,647 bytes
+ */
+private final long ZIP_SEGMENT_MIN_SIZE = 64 * 1024L;
+private final long ZIP_SEGMENT_MAX_SIZE = 4294967295L;
+
+/**
+ * Create a split zip. If the zip file is smaller than the split size,
+ * then there will only be one split zip, and its suffix is .zip,
+ * otherwise the split segments should be like .z01, .z02, ... .z(N-1), 
.zip
+ *
+ * @param zipFile   the zip file to write to
+ * @param splitSize the split size
+ */
+public ZipSplitOutputStream(final File zipFile, final long splitSize) 
throws IllegalArgumentException, IOException {
+if (splitSize < ZIP_SEGMENT_MIN_SIZE || splitSize > 
ZIP_SEGMENT_MAX_SIZE) {
+throw new IllegalArgumentException("zip split segment size should 
between 64K and 4,294,967,295");
+}
+
+this.zipFile = zipFile;
+this.splitSize = splitSize;
+
+this.outputStream = new FileOutputStream(zipFile);
+// write the zip split signature 0x08074B50 to the zip file
+writeZipSplitSignature();
+}
+
+/**
+ * Some data can not be written to different split segments, for example:
+ * 
+ * 4.4.1.5  The end of central directory record and the Zip64 end
+ * of central directory locator record MUST reside on the same
+ * disk when splitting or spanning an archive.
+ *
+ * @param unsplittableContentSize
+ * @throws IllegalArgumentException
+ * @throws IOException
+ */
+public void prepareToWriteUnsplittableContent(long 
unsplittableContentSize) throws IllegalArgumentException, IOException {
+if (unsplittableContentSize > this.splitSize) {
+throw new IllegalArgumentException("The unsplittable content size 
is bigger than the split segment size");
+}
+
+long bytesRemainingInThisSegment = this.splitSize - 
this.currentSplitSegmentBytesWritten;
+if (bytesRemainingInThisSegment < unsplittableContentSize) {
+openNewSplitSegment();
+}
+}
+
+@Override
+public void write(int i) throws IOException {
+byte[] b = ByteBuffer.allocate(4).putInt(i).array();
 
 Review comment:
   Agree. This should no doubt be a single byte. Sorry for my careless.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354093)
Time Spent: 8h  (was: 7h 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354091=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354091
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:21
Start Date: 05/Dec/19 07:21
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #86: 
COMPRESS-477 building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r354142071
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java
 ##
 @@ -0,0 +1,236 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+public class ZipSplitOutputStream extends OutputStream {
+private OutputStream outputStream;
+private File zipFile;
+private long splitSize;
+private int currentSplitSegmentIndex = 0;
+private long currentSplitSegmentBytesWritten = 0;
+private boolean finished = false;
+
+/**
+ * 8.5.1 Capacities for split archives are as follows:
+ * 
+ * Maximum number of segments = 4,294,967,295 - 1
+ * Maximum .ZIP segment size = 4,294,967,295 bytes (refer to section 8.5.6)
+ * Minimum segment size = 64K
+ * Maximum PKSFX segment size = 2,147,483,647 bytes
+ */
+private final long ZIP_SEGMENT_MIN_SIZE = 64 * 1024L;
+private final long ZIP_SEGMENT_MAX_SIZE = 4294967295L;
+
+/**
+ * Create a split zip. If the zip file is smaller than the split size,
+ * then there will only be one split zip, and its suffix is .zip,
+ * otherwise the split segments should be like .z01, .z02, ... .z(N-1), 
.zip
+ *
+ * @param zipFile   the zip file to write to
+ * @param splitSize the split size
+ */
+public ZipSplitOutputStream(final File zipFile, final long splitSize) 
throws IllegalArgumentException, IOException {
+if (splitSize < ZIP_SEGMENT_MIN_SIZE || splitSize > 
ZIP_SEGMENT_MAX_SIZE) {
+throw new IllegalArgumentException("zip split segment size should 
between 64K and 4,294,967,295");
+}
+
+this.zipFile = zipFile;
+this.splitSize = splitSize;
+
+this.outputStream = new FileOutputStream(zipFile);
+// write the zip split signature 0x08074B50 to the zip file
+writeZipSplitSignature();
+}
+
+/**
+ * Some data can not be written to different split segments, for example:
+ * 
+ * 4.4.1.5  The end of central directory record and the Zip64 end
+ * of central directory locator record MUST reside on the same
+ * disk when splitting or spanning an archive.
+ *
+ * @param unsplittableContentSize
+ * @throws IllegalArgumentException
+ * @throws IOException
+ */
+public void prepareToWriteUnsplittableContent(long 
unsplittableContentSize) throws IllegalArgumentException, IOException {
+if (unsplittableContentSize > this.splitSize) {
+throw new IllegalArgumentException("The unsplittable content size 
is bigger than the split segment size");
+}
+
+long bytesRemainingInThisSegment = this.splitSize - 
this.currentSplitSegmentBytesWritten;
+if (bytesRemainingInThisSegment < unsplittableContentSize) {
+openNewSplitSegment();
+}
+}
+
+@Override
+public void write(int i) throws IOException {
+byte[] b = ByteBuffer.allocate(4).putInt(i).array();
+write(b);
+}
+
+@Override
+public void write(byte[] b) throws IOException {
+write(b, 0, b.length);
+}
+
+/**
+ * Write the data to zip split segments, if the remaining space of current 
split segment
+ * is not enough, then a new split segment should be created
+ *
+ * @param b   data to write
+ * @param off offset of the start of data in param b
+ * @param len the length of data to write
+ * @throws IOException
+ */
+@Override
+public 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354092=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354092
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 07:21
Start Date: 05/Dec/19 07:21
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #86: 
COMPRESS-477 building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r354142088
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java
 ##
 @@ -0,0 +1,236 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+public class ZipSplitOutputStream extends OutputStream {
+private OutputStream outputStream;
+private File zipFile;
+private long splitSize;
 
 Review comment:
   Agree
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354092)
Time Spent: 7h 50m  (was: 7h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 7h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354030=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354030
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 04:02
Start Date: 05/Dec/19 04:02
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354101926
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
 ##
 @@ -367,13 +367,9 @@ public ZipArchiveEntry getNextZipEntry() throws 
IOException {
 private void readFirstLocalFileHeader(final byte[] lfh) throws IOException 
{
 readFully(lfh);
 final ZipLong sig = new ZipLong(lfh);
-if (sig.equals(ZipLong.DD_SIG)) {
 
 Review comment:
   I don't fully understand this. I'm a little confused about this.
   
   My understanding about this review is :
   We should add a new flag like `skipSplitZipSig` in the constructor of 
`ZipArchiveInputStream`. Then we will only skip the `ZipLong.DD_SIG` signature 
when the `skipSplitZipSig` is set.
   
   Am I right?
   
   
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354030)
Time Spent: 7h 20m  (was: 7h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 7h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354022=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354022
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 03:28
Start Date: 05/Dec/19 03:28
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354095888
 
 

 ##
 File path: src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
 ##
 @@ -143,6 +144,11 @@
  */
 private volatile boolean closed = true;
 
+/**
+ * Whether the zip archive is a splite zip archive
+ */
+private boolean isSplitZipArchive = false;
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354022)
Time Spent: 6h 40m  (was: 6.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 6h 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354024=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354024
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 03:28
Start Date: 05/Dec/19 03:28
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354095921
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
 ##
 @@ -44,9 +44,9 @@
  */
 public class MultiReadOnlySeekableByteChannel implements SeekableByteChannel {
 
-private final List channels;
-private long globalPosition;
-private int currentChannelIdx;
+protected final List channels;
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354024)
Time Spent: 6h 50m  (was: 6h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 6h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354026=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354026
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 03:28
Start Date: 05/Dec/19 03:28
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354095921
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
 ##
 @@ -44,9 +44,9 @@
  */
 public class MultiReadOnlySeekableByteChannel implements SeekableByteChannel {
 
-private final List channels;
-private long globalPosition;
-private int currentChannelIdx;
+protected final List channels;
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354026)
Time Spent: 7h 10m  (was: 7h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 7h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-04 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=354025=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354025
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Dec/19 03:28
Start Date: 05/Dec/19 03:28
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #84: 
COMPRESS-477 Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r354095888
 
 

 ##
 File path: src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
 ##
 @@ -143,6 +144,11 @@
  */
 private volatile boolean closed = true;
 
+/**
+ * Whether the zip archive is a splite zip archive
+ */
+private boolean isSplitZipArchive = false;
 
 Review comment:
   Agree.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 354025)
Time Spent: 7h  (was: 6h 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 7h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351758=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351758
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 06:09
Start Date: 02/Dec/19 06:09
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-560247636
 
 
   I can see the comments now. I will fix all these ASAP.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351758)
Time Spent: 6h 20m  (was: 6h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 6h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351759=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351759
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 06:09
Start Date: 02/Dec/19 06:09
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-560247669
 
 
   I can see the comments now. I will fix all these ASAP.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351759)
Time Spent: 6.5h  (was: 6h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 6.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351748=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351748
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:19
Start Date: 02/Dec/19 05:19
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-560235408
 
 
   Obviously this has been my fault and I had to "submit" the review in order 
to make it visible. Sorry for the confusion as well as for the delay.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351748)
Time Spent: 6h 10m  (was: 6h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 6h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351739=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351739
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341815590
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
 ##
 @@ -367,13 +367,9 @@ public ZipArchiveEntry getNextZipEntry() throws 
IOException {
 private void readFirstLocalFileHeader(final byte[] lfh) throws IOException 
{
 readFully(lfh);
 final ZipLong sig = new ZipLong(lfh);
-if (sig.equals(ZipLong.DD_SIG)) {
 
 Review comment:
   I think I'd prefer to make this conditional on an explicit flag passed in 
the constructor so people who do not expect split archives won't see incomplete 
archives without any indication of the problem.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351739)
Time Spent: 5h 10m  (was: 5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 5h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351745=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351745
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341852065
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.zip.ZipLong;
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+public class ZipSplitReadOnlySeekableByteChannel extends 
MultiReadOnlySeekableByteChannel {
+protected final int ZIP_SPLIT_SIGNATURE_LENGTH = 4;
+protected ByteBuffer zipSplitSignatureByteBuffer = 
ByteBuffer.allocate(ZIP_SPLIT_SIGNATURE_LENGTH);
+
+/**
+ * Concatenates the given channels.
+ * the channels should be add in ascending order, e.g. z01, z02, ... z99, 
zip
+ * please note that the .zip file is the last segment and should be added 
as the last one in the channels
+ *
+ * The first 4 bytes of split zip signature will be taken into 
consideration by Inflator,
+ * so we don't need to skip them
+ *
+ * @param channels the channels to concatenate
+ * @throws NullPointerException if channels is null
+ */
+public ZipSplitReadOnlySeekableByteChannel(List 
channels) throws IOException {
+super(channels);
+
+// each split zip segment should begin with zip split signature
+validSplitSignature(channels);
+}
+
+/**
+ * the first 4 bytes of zip split segments should be the zip split 
signature(0x08074B50)
+ *
+ * @param channels channels to be valided
+ * @throws IOException
+ */
+private void validSplitSignature(final List channels) 
throws IOException {
+for(int i = 0;i < channels.size();i++) {
+SeekableByteChannel channel = channels.get(i);
+// the zip split file signature is always at the beginning of the 
segment
+channel.position(0L);
+
+channel.read(zipSplitSignatureByteBuffer);
+final ZipLong signature = new 
ZipLong(zipSplitSignatureByteBuffer.array());
+if(!signature.equals(ZipLong.DD_SIG)) {
+channel.position(0L);
+throw new IOException("No." + (i + 1) +  " split zip file is 
not begin with split zip file signature");
+}
+
+channel.position(0L);
+}
+}
+
+/**
+ * set the position based on the given disk number and relative offset
+ *
+ * @param diskNumber the disk number of split zip files
+ * @param relativeOffset the offset in the split zip segment with given 
disk number
+ * @return global position of all split zip files as if they are a single 
channel
+ * @throws IOException
+ */
+public synchronized SeekableByteChannel position(long diskNumber, long 
relativeOffset) throws IOException {
+long globalPosition = relativeOffset;
+for(int i = 0; i < diskNumber;i++) {
+globalPosition += channels.get(i).size();
+}
+
+return position(globalPosition);
+}
+
+/**
+ * Concatenates the given channels.
+ *
+ * @param channels the channels to concatenate, note that the LAST CHANNEL 
of channels 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351742=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351742
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341815900
 
 

 ##
 File path: src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
 ##
 @@ -143,6 +144,11 @@
  */
 private volatile boolean closed = true;
 
+/**
+ * Whether the zip archive is a splite zip archive
+ */
+private boolean isSplitZipArchive = false;
 
 Review comment:
   could be `final` if you defer assigning to it inside of the constructor.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351742)
Time Spent: 5.5h  (was: 5h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 5.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351744=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351744
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341816324
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitSegmentComparator.java
 ##
 @@ -0,0 +1,45 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.util.Comparator;
+
+public class ZipSplitSegmentComparator implements Comparator {
 
 Review comment:
   I'd probably make that an inner class of 
`ZipSplitReadOnlySeekableByteChannel` but haven't got any strong opinion either 
way.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351744)
Time Spent: 5h 40m  (was: 5.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 5h 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351741=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351741
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341816134
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.zip.ZipLong;
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+public class ZipSplitReadOnlySeekableByteChannel extends 
MultiReadOnlySeekableByteChannel {
+protected final int ZIP_SPLIT_SIGNATURE_LENGTH = 4;
+protected ByteBuffer zipSplitSignatureByteBuffer = 
ByteBuffer.allocate(ZIP_SPLIT_SIGNATURE_LENGTH);
+
+/**
+ * Concatenates the given channels.
+ * the channels should be add in ascending order, e.g. z01, z02, ... z99, 
zip
+ * please note that the .zip file is the last segment and should be added 
as the last one in the channels
+ *
+ * The first 4 bytes of split zip signature will be taken into 
consideration by Inflator,
+ * so we don't need to skip them
+ *
+ * @param channels the channels to concatenate
+ * @throws NullPointerException if channels is null
+ */
+public ZipSplitReadOnlySeekableByteChannel(List 
channels) throws IOException {
+super(channels);
+
+// each split zip segment should begin with zip split signature
+validSplitSignature(channels);
+}
+
+/**
+ * the first 4 bytes of zip split segments should be the zip split 
signature(0x08074B50)
+ *
+ * @param channels channels to be valided
+ * @throws IOException
+ */
+private void validSplitSignature(final List channels) 
throws IOException {
+for(int i = 0;i < channels.size();i++) {
+SeekableByteChannel channel = channels.get(i);
+// the zip split file signature is always at the beginning of the 
segment
+channel.position(0L);
+
+channel.read(zipSplitSignatureByteBuffer);
+final ZipLong signature = new 
ZipLong(zipSplitSignatureByteBuffer.array());
+if(!signature.equals(ZipLong.DD_SIG)) {
+channel.position(0L);
+throw new IOException("No." + (i + 1) +  " split zip file is 
not begin with split zip file signature");
+}
+
+channel.position(0L);
+}
+}
+
+/**
+ * set the position based on the given disk number and relative offset
+ *
+ * @param diskNumber the disk number of split zip files
+ * @param relativeOffset the offset in the split zip segment with given 
disk number
+ * @return global position of all split zip files as if they are a single 
channel
+ * @throws IOException
+ */
+public synchronized SeekableByteChannel position(long diskNumber, long 
relativeOffset) throws IOException {
 
 Review comment:
   this method could live inside of the superclass (with diskNumber renamed to 
channelNumber or something like that). I think that would avoid making the 
fields protected.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351740=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351740
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341816060
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
 ##
 @@ -44,9 +44,9 @@
  */
 public class MultiReadOnlySeekableByteChannel implements SeekableByteChannel {
 
-private final List channels;
-private long globalPosition;
-private int currentChannelIdx;
+protected final List channels;
 
 Review comment:
   I'd prefer if you added protected methods accessing the fields rather than 
making the fields protected.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351740)
Time Spent: 5h 20m  (was: 5h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 5h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351743=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351743
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341816217
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.zip.ZipLong;
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+public class ZipSplitReadOnlySeekableByteChannel extends 
MultiReadOnlySeekableByteChannel {
+protected final int ZIP_SPLIT_SIGNATURE_LENGTH = 4;
+protected ByteBuffer zipSplitSignatureByteBuffer = 
ByteBuffer.allocate(ZIP_SPLIT_SIGNATURE_LENGTH);
+
+/**
+ * Concatenates the given channels.
+ * the channels should be add in ascending order, e.g. z01, z02, ... z99, 
zip
+ * please note that the .zip file is the last segment and should be added 
as the last one in the channels
+ *
+ * The first 4 bytes of split zip signature will be taken into 
consideration by Inflator,
+ * so we don't need to skip them
+ *
+ * @param channels the channels to concatenate
+ * @throws NullPointerException if channels is null
+ */
+public ZipSplitReadOnlySeekableByteChannel(List 
channels) throws IOException {
+super(channels);
+
+// each split zip segment should begin with zip split signature
+validSplitSignature(channels);
+}
+
+/**
+ * the first 4 bytes of zip split segments should be the zip split 
signature(0x08074B50)
+ *
+ * @param channels channels to be valided
+ * @throws IOException
+ */
+private void validSplitSignature(final List channels) 
throws IOException {
+for(int i = 0;i < channels.size();i++) {
+SeekableByteChannel channel = channels.get(i);
+// the zip split file signature is always at the beginning of the 
segment
+channel.position(0L);
+
+channel.read(zipSplitSignatureByteBuffer);
+final ZipLong signature = new 
ZipLong(zipSplitSignatureByteBuffer.array());
+if(!signature.equals(ZipLong.DD_SIG)) {
+channel.position(0L);
+throw new IOException("No." + (i + 1) +  " split zip file is 
not begin with split zip file signature");
+}
+
+channel.position(0L);
+}
+}
+
+/**
+ * set the position based on the given disk number and relative offset
+ *
+ * @param diskNumber the disk number of split zip files
+ * @param relativeOffset the offset in the split zip segment with given 
disk number
+ * @return global position of all split zip files as if they are a single 
channel
+ * @throws IOException
+ */
+public synchronized SeekableByteChannel position(long diskNumber, long 
relativeOffset) throws IOException {
+long globalPosition = relativeOffset;
+for(int i = 0; i < diskNumber;i++) {
+globalPosition += channels.get(i).size();
+}
+
+return position(globalPosition);
+}
+
+/**
+ * Concatenates the given channels.
+ *
+ * @param channels the channels to concatenate, note that the LAST CHANNEL 
of channels 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351747=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351747
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341816299
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
 
 Review comment:
   move to the zip package instead?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351747)
Time Spent: 6h  (was: 5h 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 6h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351738=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351738
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #86: COMPRESS-477 building a 
split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-560234164
 
 
   Sorry, I misunderstood github's code review feature and wasn't aware I was 
the only one who could see it until I "sumitted" the review. There was no 
indication that the review is only visible to myself, sorry about that.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351738)
Time Spent: 5h  (was: 4h 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351746=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351746
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:14
Start Date: 02/Dec/19 05:14
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#discussion_r341818343
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/utils/ZipSplitReadOnlySeekableByteChannel.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.utils;
+
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.zip.ZipLong;
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+public class ZipSplitReadOnlySeekableByteChannel extends 
MultiReadOnlySeekableByteChannel {
+protected final int ZIP_SPLIT_SIGNATURE_LENGTH = 4;
+protected ByteBuffer zipSplitSignatureByteBuffer = 
ByteBuffer.allocate(ZIP_SPLIT_SIGNATURE_LENGTH);
+
+/**
+ * Concatenates the given channels.
+ * the channels should be add in ascending order, e.g. z01, z02, ... z99, 
zip
+ * please note that the .zip file is the last segment and should be added 
as the last one in the channels
+ *
+ * The first 4 bytes of split zip signature will be taken into 
consideration by Inflator,
+ * so we don't need to skip them
+ *
+ * @param channels the channels to concatenate
+ * @throws NullPointerException if channels is null
+ */
+public ZipSplitReadOnlySeekableByteChannel(List 
channels) throws IOException {
+super(channels);
+
+// each split zip segment should begin with zip split signature
+validSplitSignature(channels);
+}
+
+/**
+ * the first 4 bytes of zip split segments should be the zip split 
signature(0x08074B50)
+ *
+ * @param channels channels to be valided
+ * @throws IOException
+ */
+private void validSplitSignature(final List channels) 
throws IOException {
+for(int i = 0;i < channels.size();i++) {
+SeekableByteChannel channel = channels.get(i);
+// the zip split file signature is always at the beginning of the 
segment
+channel.position(0L);
+
+channel.read(zipSplitSignatureByteBuffer);
+final ZipLong signature = new 
ZipLong(zipSplitSignatureByteBuffer.array());
+if(!signature.equals(ZipLong.DD_SIG)) {
+channel.position(0L);
+throw new IOException("No." + (i + 1) +  " split zip file is 
not begin with split zip file signature");
+}
+
+channel.position(0L);
+}
+}
+
+/**
+ * set the position based on the given disk number and relative offset
+ *
+ * @param diskNumber the disk number of split zip files
+ * @param relativeOffset the offset in the split zip segment with given 
disk number
+ * @return global position of all split zip files as if they are a single 
channel
+ * @throws IOException
+ */
+public synchronized SeekableByteChannel position(long diskNumber, long 
relativeOffset) throws IOException {
+long globalPosition = relativeOffset;
+for(int i = 0; i < diskNumber;i++) {
+globalPosition += channels.get(i).size();
+}
+
+return position(globalPosition);
+}
+
+/**
+ * Concatenates the given channels.
+ *
+ * @param channels the channels to concatenate, note that the LAST CHANNEL 
of channels 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351736=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351736
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:12
Start Date: 02/Dec/19 05:12
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r352363303
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java
 ##
 @@ -0,0 +1,236 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+public class ZipSplitOutputStream extends OutputStream {
+private OutputStream outputStream;
+private File zipFile;
+private long splitSize;
+private int currentSplitSegmentIndex = 0;
+private long currentSplitSegmentBytesWritten = 0;
+private boolean finished = false;
+
+/**
+ * 8.5.1 Capacities for split archives are as follows:
+ * 
+ * Maximum number of segments = 4,294,967,295 - 1
+ * Maximum .ZIP segment size = 4,294,967,295 bytes (refer to section 8.5.6)
+ * Minimum segment size = 64K
+ * Maximum PKSFX segment size = 2,147,483,647 bytes
+ */
+private final long ZIP_SEGMENT_MIN_SIZE = 64 * 1024L;
+private final long ZIP_SEGMENT_MAX_SIZE = 4294967295L;
+
+/**
+ * Create a split zip. If the zip file is smaller than the split size,
+ * then there will only be one split zip, and its suffix is .zip,
+ * otherwise the split segments should be like .z01, .z02, ... .z(N-1), 
.zip
+ *
+ * @param zipFile   the zip file to write to
+ * @param splitSize the split size
+ */
+public ZipSplitOutputStream(final File zipFile, final long splitSize) 
throws IllegalArgumentException, IOException {
+if (splitSize < ZIP_SEGMENT_MIN_SIZE || splitSize > 
ZIP_SEGMENT_MAX_SIZE) {
+throw new IllegalArgumentException("zip split segment size should 
between 64K and 4,294,967,295");
+}
+
+this.zipFile = zipFile;
+this.splitSize = splitSize;
+
+this.outputStream = new FileOutputStream(zipFile);
+// write the zip split signature 0x08074B50 to the zip file
+writeZipSplitSignature();
+}
+
+/**
+ * Some data can not be written to different split segments, for example:
+ * 
+ * 4.4.1.5  The end of central directory record and the Zip64 end
+ * of central directory locator record MUST reside on the same
+ * disk when splitting or spanning an archive.
+ *
+ * @param unsplittableContentSize
+ * @throws IllegalArgumentException
+ * @throws IOException
+ */
+public void prepareToWriteUnsplittableContent(long 
unsplittableContentSize) throws IllegalArgumentException, IOException {
+if (unsplittableContentSize > this.splitSize) {
+throw new IllegalArgumentException("The unsplittable content size 
is bigger than the split segment size");
+}
+
+long bytesRemainingInThisSegment = this.splitSize - 
this.currentSplitSegmentBytesWritten;
+if (bytesRemainingInThisSegment < unsplittableContentSize) {
+openNewSplitSegment();
+}
+}
+
+@Override
+public void write(int i) throws IOException {
+byte[] b = ByteBuffer.allocate(4).putInt(i).array();
 
 Review comment:
   this should only write a single byte, see the contract of `OutputStream` 
https://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html#write(int)
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351737=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351737
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:12
Start Date: 02/Dec/19 05:12
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r352363968
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
 ##
 @@ -193,4 +193,19 @@ public String getCompressedFilename(final String 
fileName) {
 return fileName + defaultExtension;
 }
 
+public static String getBaseName(String filename) {
+if (filename == null) {
+return null;
+}
+
+int lastSeparatorPosition = Math.max(filename.lastIndexOf('/'), 
filename.lastIndexOf('\\'));
+String name = filename.substring(lastSeparatorPosition + 1);
 
 Review comment:
   `new File(filename).getName()` will give you the last segment of the path. 
This is more robust than the `lastIndexOf` approach.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351737)
Time Spent: 4h 50m  (was: 4h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351735=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351735
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:12
Start Date: 02/Dec/19 05:12
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r352363397
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java
 ##
 @@ -0,0 +1,236 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+public class ZipSplitOutputStream extends OutputStream {
+private OutputStream outputStream;
+private File zipFile;
+private long splitSize;
 
 Review comment:
   `splitSize` can and should be final
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351735)
Time Spent: 4h 40m  (was: 4.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 4h 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351734=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351734
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:12
Start Date: 02/Dec/19 05:12
Worklog Time Spent: 10m 
  Work Description: bodewig commented on pull request #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#discussion_r352363826
 
 

 ##
 File path: 
src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitOutputStream.java
 ##
 @@ -0,0 +1,236 @@
+/*
+ *  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
+ *
+ *  http://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.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.compressors.FileNameUtil;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+public class ZipSplitOutputStream extends OutputStream {
+private OutputStream outputStream;
+private File zipFile;
+private long splitSize;
+private int currentSplitSegmentIndex = 0;
+private long currentSplitSegmentBytesWritten = 0;
+private boolean finished = false;
+
+/**
+ * 8.5.1 Capacities for split archives are as follows:
+ * 
+ * Maximum number of segments = 4,294,967,295 - 1
+ * Maximum .ZIP segment size = 4,294,967,295 bytes (refer to section 8.5.6)
+ * Minimum segment size = 64K
+ * Maximum PKSFX segment size = 2,147,483,647 bytes
+ */
+private final long ZIP_SEGMENT_MIN_SIZE = 64 * 1024L;
+private final long ZIP_SEGMENT_MAX_SIZE = 4294967295L;
+
+/**
+ * Create a split zip. If the zip file is smaller than the split size,
+ * then there will only be one split zip, and its suffix is .zip,
+ * otherwise the split segments should be like .z01, .z02, ... .z(N-1), 
.zip
+ *
+ * @param zipFile   the zip file to write to
+ * @param splitSize the split size
+ */
+public ZipSplitOutputStream(final File zipFile, final long splitSize) 
throws IllegalArgumentException, IOException {
+if (splitSize < ZIP_SEGMENT_MIN_SIZE || splitSize > 
ZIP_SEGMENT_MAX_SIZE) {
+throw new IllegalArgumentException("zip split segment size should 
between 64K and 4,294,967,295");
+}
+
+this.zipFile = zipFile;
+this.splitSize = splitSize;
+
+this.outputStream = new FileOutputStream(zipFile);
+// write the zip split signature 0x08074B50 to the zip file
+writeZipSplitSignature();
+}
+
+/**
+ * Some data can not be written to different split segments, for example:
+ * 
+ * 4.4.1.5  The end of central directory record and the Zip64 end
+ * of central directory locator record MUST reside on the same
+ * disk when splitting or spanning an archive.
+ *
+ * @param unsplittableContentSize
+ * @throws IllegalArgumentException
+ * @throws IOException
+ */
+public void prepareToWriteUnsplittableContent(long 
unsplittableContentSize) throws IllegalArgumentException, IOException {
+if (unsplittableContentSize > this.splitSize) {
+throw new IllegalArgumentException("The unsplittable content size 
is bigger than the split segment size");
+}
+
+long bytesRemainingInThisSegment = this.splitSize - 
this.currentSplitSegmentBytesWritten;
+if (bytesRemainingInThisSegment < unsplittableContentSize) {
+openNewSplitSegment();
+}
+}
+
+@Override
+public void write(int i) throws IOException {
+byte[] b = ByteBuffer.allocate(4).putInt(i).array();
+write(b);
+}
+
+@Override
+public void write(byte[] b) throws IOException {
+write(b, 0, b.length);
+}
+
+/**
+ * Write the data to zip split segments, if the remaining space of current 
split segment
+ * is not enough, then a new split segment should be created
+ *
+ * @param b   data to write
+ * @param off offset of the start of data in param b
+ * @param len the length of data to write
+ * @throws IOException
+ */
+@Override
+public void 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351733=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351733
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 05:11
Start Date: 02/Dec/19 05:11
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #86: COMPRESS-477 building a 
split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-560233565
 
 
   For me there is a "@bodewig started a review" section right on this 
conversation page and I see my comments inline inside of the Files panel. But 
if I look at things in a separate browser without being signed in I don't see 
anything either. Strange.
   
   I'll try to figure things out.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351733)
Time Spent: 4.5h  (was: 4h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 4.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351692=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351692
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 01:36
Start Date: 02/Dec/19 01:36
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-560190222
 
 
   @bodewig Thank you so much.
   Unfortunely, just like the other PR, I can't see any comments in `File 
changed` panel of thie PR. I'm sorry if I missed something. Would you please 
tell me where I can see the comments if I missed the comments?
   
   > I'm not sure whether the split feature and parallel creation of archives 
could be combined, I don't think it would be possible but need to ponder it a 
bit longer. If it is indeed not possible, we should document the fact.
   
   I'll look into this.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351692)
Time Spent: 4h 20m  (was: 4h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 4h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351691=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351691
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Dec/19 01:33
Start Date: 02/Dec/19 01:33
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-560189718
 
 
   @bodewig Thank you for your reviews.
   But it seems there's a little problem : I didn't see any comments. I double 
checked my PR in `File changed` panel on github and I looked through all code. 
I can not find any comments. And I checked my email and the [JIRA issue 
477](https://issues.apache.org/jira/projects/COMPRESS/issues/COMPRESS-477?filter=allopenissues),
 still I didn't find any comments. Maybe I missed something? Or there's another 
place in github that can be commented? I'm so sorry if I really missed 
something. Please tell me where I can see the comments if I missed the comments.
   
   > I read this tosay it should be possible to combine a split archive into a 
"normal" one using zip. I haven't tried it myself, though.
   
   I'll look into this.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351691)
Time Spent: 4h 10m  (was: 4h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
> Fix For: 1.20
>
>  Time Spent: 4h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351650=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351650
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 01/Dec/19 18:43
Start Date: 01/Dec/19 18:43
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #86: COMPRESS-477 building a 
split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-560142927
 
 
   @PeterAlfreadLee this looks very good overall, many thanks. I've added a few 
review comments. Apart from that some `@since` markers and javadocs would be 
nice.
   
   I'm not sure whether the split feature and parallel creation of archives 
could be combined, I don't think it would be possible but need to ponder it a 
bit longer. If it is indeed not possible, we should document the fact.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351650)
Time Spent: 4h  (was: 3h 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 4h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351648=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351648
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 01/Dec/19 18:00
Start Date: 01/Dec/19 18:00
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-560137512
 
 
   @PeterAlfreadLee there are a couple of review comments I made at the same 
time I commented about having a separate PR for creating split archives. You 
most probably have just missed them.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351648)
Time Spent: 3h 50m  (was: 3h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-12-01 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=351647=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-351647
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 01/Dec/19 17:54
Start Date: 01/Dec/19 17:54
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-560137003
 
 
   Before I start another round of review here, this is from Linux `unzip` 
manual
   
   >  Multi-part  archives  are not yet supported, except in conjunction 
with
   >  zip.  (All parts must be concatenated together in order, and then 
``zip
   >  -F''  (for  zip  2.x) or ``zip -FF'' (for zip 3.x) must be performed 
on
   >  the concatenated archive in order to ``fix'' it.   Also,  zip  3.0  
and
   >  later  can  combine multi-part (split) archives into a combined 
single-
   >  file archive using ``zip -s- inarchive -O outarchive''.  See the zip  
3
   >  manual  page  for more information.)  This will definitely be 
corrected
   >  in the next major release.
   
   I read this tosay it should be possible to combine a split archive into a 
"normal" one using `zip`. I haven't tried it myself, though.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 351647)
Time Spent: 3h 40m  (was: 3.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=343050=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-343050
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 14/Nov/19 01:12
Start Date: 14/Nov/19 01:12
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-553677838
 
 
   Hi, @bodewig 
   How is this PR being reviewed by now? Please feel free to let me know any 
kind of problems I need to modify.
   I have already pushed the new PR about building a split zip. Unfortunely 
there are some minor merge conflicts in the new PR with this PR(like 
`getBaseName`, adding `diskNumberStart` in `ZipArchiveEntry` and some files for 
testing), and some testcases need to be added to valid the building of split 
zip(I can also import a new library to validate it, but I don't want to do 
that). I hope this PR could be merged so that I can resolve these conflists, 
but of course you can merge them and resoulve these problems by yourself. It's 
all up to you.
   Thank you for your effort creating such a great library.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 343050)
Time Spent: 3.5h  (was: 3h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-11 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=341706=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-341706
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 12/Nov/19 07:19
Start Date: 12/Nov/19 07:19
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #86: COMPRESS-477 
building a split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-552767497
 
 
   The travis-ci failed when building on openjdk12, and all the others are 
passed.
   I tested my code on Ubuntu with oracle jdk8 by `mvn verify` and it's passed.
   I checked the log and I think it's a problem caused by network, but I'm not 
sure about this.
   Is this a problem caused by my code?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 341706)
Time Spent: 3h 20m  (was: 3h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 3h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-11 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=341703=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-341703
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 12/Nov/19 07:12
Start Date: 12/Nov/19 07:12
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #86: COMPRESS-477 building 
a split zip
URL: https://github.com/apache/commons-compress/pull/86#issuecomment-552765671
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/26929523/badge)](https://coveralls.io/builds/26929523)
   
   Coverage increased (+0.08%) to 86.792% when pulling 
**3ec845ac10936986e38a042d0a210855ed8b9e39 on 
PeterAlfreadLee:COMPRESS-477-constructing** into 
**28049d2f89a76c5a4845c12151a483ca7773fb6f on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 341703)
Time Spent: 3h 10m  (was: 3h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-11 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=341701=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-341701
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 12/Nov/19 07:09
Start Date: 12/Nov/19 07:09
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on pull request #86: 
COMPRESS-477 building a split zip
URL: https://github.com/apache/commons-compress/pull/86
 
 
   
[COMPRESS-477](https://issues.apache.org/jira/projects/COMPRESS/issues/COMPRESS-477)
   Add support for building a split/spanned zip.
   
   Sample code:
   ```
   @Test
   public void buildSplitZipTest() throws IOException {
File directoryToZip = getFilesToZip();
File outputZipFile = new File(dir, "splitZip.zip");
long splitSize = 100 * 1024L; /* 100 KB */
final ZipArchiveOutputStream zipArchiveOutputStream = new 
ZipArchiveOutputStream(outputZipFile, splitSize);
   
addFilesToZip(zipArchiveOutputStream, directoryToZip);
zipArchiveOutputStream.close();
// TODO: validate the created zip files when extracting split zip is 
merged into master
   }
   
   private void addFilesToZip(ZipArchiveOutputStream zipArchiveOutputStream, 
File fileToAdd) throws IOException {
if(fileToAdd.isDirectory()) {
for(File file : fileToAdd.listFiles()) {
addFilesToZip(zipArchiveOutputStream, file);
}
} else {
ZipArchiveEntry zipArchiveEntry = new 
ZipArchiveEntry(fileToAdd.getPath());
zipArchiveEntry.setMethod(ZipEntry.DEFLATED);
   
zipArchiveOutputStream.putArchiveEntry(zipArchiveEntry);
IOUtils.copy(new FileInputStream(fileToAdd), 
zipArchiveOutputStream);
zipArchiveOutputStream.closeArchiveEntry();
}
   }
   ```
   
   This PR is implemented by adding a new class `ZipSplitOutputStream`, and 
it's mainly implemented like this:
   1. Write the zip split signature to the zip file in the constructor of 
`ZipSplitOutputStream` by calling `writeZipSplitSignature`;
   2. Based on the zip specification, the split size must between 64K and 
4,294,967,295 bytes;
   3. Rename the split zip files like .z01, .z02, ... , .z(N-1), .zip ONLY IF 
there are more than 1 split segment;
   4. Get the only split segment whose suffix is .zip IF the split size is big 
enough(it means the split size is bigger than the actual zip size);
   5. Create a new zip split segment if the size of data to write exceeds split 
size, and the newly created zip segment will be named in the sequence like 
.z01, .z02, ..., .z99, .z100, .z101, ... , .zip;
   6. Based on the zip specification, the End Of Central Directory(EOCD) and 
Zip64 End Of Central Directory Locator(Zip64_EOCDL) must reside on the same 
segment, so the `ZipSplitOutputStream` will create a new segment if the 
remaining size is not enough before writing EOCD and Zip64_EOCDL;
   7. When creating `ZipArchiveOutputStream`, if the split size is specified, 
it will create a split zip instead of normal zip(as the `ZipSplitOutputStream` 
need the file name when creating new split segments, the constructor is like 
`public ZipArchiveOutputStream(final File file, final long zipSplitSize)`);
   8. The disk number, relative offset, number of this disk, number of Central 
Directories on this disk, total number of disks in Central Directory, Zip64 End 
Of Central Directory, Zip64 End Of Central Directory Locator, End Of Central 
Directory have all been tuned to the right value when writing a split/spanned 
zip;
   9. The testcases need to be updated when 
[#84]{https://github.com/apache/commons-compress/pull/84} is merged because it 
seems I can not test my created split/spanned zip in Linux. I have tested it on 
Windows and it works well;
   10. This PR has some minor conflicts with 
[#84]{https://github.com/apache/commons-compress/pull/84}, and I will solve all 
these conflicts as soon as 
[#84]{https://github.com/apache/commons-compress/pull/84} is merged.
   
   Please feel free to let me know if the code need to be refactored or 
rebased. I'm looking for your reviews. :-) @bodewig @garydgregory 
   
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 341701)
Time Spent: 3h  (was: 2h 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: 

[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-08 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=340883=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-340883
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 09/Nov/19 03:58
Start Date: 09/Nov/19 03:58
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-552063435
 
 
   Just pushed some code to modify a minor bug:
   The zip split signature (0x08074B50) will only show up at the beginning of 
the first zip split segment, not every segment. So we should only validate if 
the first zip split segment is begun with split signature(0x08074B50).
   
   BTW:
   I have finished the code of building a split zip. I hope I can push my PR 
when this PR of extracting split zip is merged, because I want to write some 
testcases for the building of split zip.
   It's not easy to test a split zip in linux because the Zip command line tool 
only support constructing a split zip, not extracting them(I have to admit that 
this amazed me) and 7z in linux doesn't support split zip.
   I have no idea how can I test my constructed split zip in linux(on the other 
hand it's OK in Windows). If you have any ideas about it, I would highly 
appreciate it if you can teach me about it. @bodewig   :-)
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 340883)
Time Spent: 2h 50m  (was: 2h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-08 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=340882=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-340882
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 09/Nov/19 03:53
Start Date: 09/Nov/19 03:53
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545874938
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/26872243/badge)](https://coveralls.io/builds/26872243)
   
   Coverage increased (+0.2%) to 86.916% when pulling 
**ab49767011a43a5374bf9a79037d25cca69ce3f0 on PeterAlfreadLee:COMPRESS_477** 
into **28049d2f89a76c5a4845c12151a483ca7773fb6f on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 340882)
Time Spent: 2h 40m  (was: 2.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-05 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=338595=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-338595
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 05/Nov/19 08:25
Start Date: 05/Nov/19 08:25
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-549714757
 
 
   > I agree it would be better to separate it into a new PR.
   > 
   > I'm not sure if/how the creation code would overlap with the reading code 
so guess it wouldn't cause any merge conflicts if you started the new one in 
parallel but will leave that up to you.
   
   Sure. I will separate it into another new PR.
   For now there are only some minor merge conflicts, most of them is some file 
utils like `getBaseName`, and I will solve the conflicts when this PR is merged.
   
   Please let me know if the code need to be modified when you found something. 
Thank you for your review @bodewig 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 338595)
Time Spent: 2.5h  (was: 2h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-02 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=337715=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-337715
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Nov/19 16:11
Start Date: 02/Nov/19 16:11
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-549057606
 
 
   Many thanks again @PeterAlfreadLee 
   
   Please don't take my review comments as a pushback, many of them are minor. 
Overall your PR looks really good and I'm looking forward to merging it into 
the next release.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 337715)
Time Spent: 2h 20m  (was: 2h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-11-02 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=337711=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-337711
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 02/Nov/19 15:41
Start Date: 02/Nov/19 15:41
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-549055156
 
 
   I agree it would be better to separate it into a new PR.
   
   I'm not sure if/how the creation code would overlap with the reading code so 
guess it wouldn't cause any merge conflicts if you started the new one in 
parallel but will leave that up to you.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 337711)
Time Spent: 2h 10m  (was: 2h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334818=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334818
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 28/Oct/19 08:29
Start Date: 28/Oct/19 08:29
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-546842154
 
 
   BTW:
   For the part of adding support for creating a splitted/spanned zip file. I'd 
like to push another PR rather than adding in this PR. But I think it would be 
better to do it when this PR is done reviewed. What do you thinkg @bodewig ? :)
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334818)
Time Spent: 2h  (was: 1h 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 2h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334811=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334811
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 28/Oct/19 08:18
Start Date: 28/Oct/19 08:18
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-546836930
 
 
   I just pushed the code of adding support for splitted zip in 
`ZipArchiveInputStream`.
   I didn't change much. Just skip the markers here
   
https://github.com/apache/commons-compress/blob/205876d6f9eb60ac31f3ec848b23d025f32995ab/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java#L370
   
   Sample code for usage guide:
   ```
   File lastFile = 
getFile("COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip_zip64.zip");
   // build the input stream by just concatenating the splitted zips together
   SeekableByteChannel channel = 
ZipSplitReadOnlySeekableByteChannel.buildFromLastSplitSegment(lastFile);
   InputStream inputStream = Channels.newInputStream(channel);
   ZipArchiveInputStream splitInputStream = new 
ZipArchiveInputStream(inputStream);
   
   ArchiveEntry entry;
   while((entry = splitInputStream.getNextEntry()) != null) {
   // read from ZipArchiveInputStream
   ...
   }
   ```
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334811)
Time Spent: 1h 50m  (was: 1h 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334810=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334810
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 28/Oct/19 08:17
Start Date: 28/Oct/19 08:17
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-546836930
 
 
   I just pushed the code of adding support for splitted zip in 
`ZipArchiveInputStream`.
   I didn't change much. Just skip the markers here
   
https://github.com/apache/commons-compress/blob/205876d6f9eb60ac31f3ec848b23d025f32995ab/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java#L370
   
   Sample code:
   ```
   File lastFile = 
getFile("COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip_zip64.zip");
   // build the input stream by just concatenating the splitted zips together
   SeekableByteChannel channel = 
ZipSplitReadOnlySeekableByteChannel.buildFromLastSplitSegment(lastFile);
   InputStream inputStream = Channels.newInputStream(channel);
   ZipArchiveInputStream splitInputStream = new 
ZipArchiveInputStream(inputStream);
   
   ArchiveEntry entry;
   while((entry = splitInputStream.getNextEntry()) != null) {
   // read from ZipArchiveInputStream
   ...
   }
   ```
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334810)
Time Spent: 1h 40m  (was: 1.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334803=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334803
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 28/Oct/19 08:13
Start Date: 28/Oct/19 08:13
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-546836930
 
 
   I just pushed the code of adding support for splitted zip in 
`ZipArchiveInputStream`.
   I didn't change much. Just skip the markers here
   [ if (sig.equals(ZipLong.DD_SIG)) 
{](https://github.com/apache/commons-compress/blob/205876d6f9eb60ac31f3ec848b23d025f32995ab/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java#L370)
   
   Sample code:
   ```
   File lastFile = 
getFile("COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip_zip64.zip");
   // build the input stream by just concatenating the splitted zips together
   SeekableByteChannel channel = 
ZipSplitReadOnlySeekableByteChannel.buildFromLastSplitSegment(lastFile);
   InputStream inputStream = Channels.newInputStream(channel);
   ZipArchiveInputStream splitInputStream = new 
ZipArchiveInputStream(inputStream);
   
   ArchiveEntry entry;
   while((entry = splitInputStream.getNextEntry()) != null) {
   // read from ZipArchiveInputStream
   ...
   }
   ```
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334803)
Time Spent: 1.5h  (was: 1h 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334802=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334802
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 28/Oct/19 08:12
Start Date: 28/Oct/19 08:12
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-546836930
 
 
   I just pushed the code of adding support for splitted zip in 
`ZipArchiveInputStream`.
   I didn't change much. Just skip the markers here
   
[](https://github.com/apache/commons-compress/blob/205876d6f9eb60ac31f3ec848b23d025f32995ab/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java#L370)
   
   Sample code:
   ```
   File lastFile = 
getFile("COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip_zip64.zip");
   // build the input stream by just concatenating the splitted zips together
   SeekableByteChannel channel = 
ZipSplitReadOnlySeekableByteChannel.buildFromLastSplitSegment(lastFile);
   InputStream inputStream = Channels.newInputStream(channel);
   ZipArchiveInputStream splitInputStream = new 
ZipArchiveInputStream(inputStream);
   
   ArchiveEntry entry;
   while((entry = splitInputStream.getNextEntry()) != null) {
   // read from ZipArchiveInputStream
   ...
   }
   ```
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334802)
Time Spent: 1h 20m  (was: 1h 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334799=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334799
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 28/Oct/19 08:09
Start Date: 28/Oct/19 08:09
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545874938
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/26584641/badge)](https://coveralls.io/builds/26584641)
   
   Coverage decreased (-0.05%) to 86.702% when pulling 
**49414cf9166f5e322979445c678599cd5aee62d8 on PeterAlfreadLee:COMPRESS_477** 
into **205876d6f9eb60ac31f3ec848b23d025f32995ab on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334799)
Time Spent: 1h 10m  (was: 1h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-27 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334674=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334674
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 28/Oct/19 01:35
Start Date: 28/Oct/19 01:35
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-546759238
 
 
   @bodewig Thank you. Please take your time.
   
   > We could either allow people using ZipArchiveInputStream to signal it 
should skip the marker or provide a "collecting stream" that skipped the first 
four bytes if necessary.
   
   I prefer with the previous implemention by skipping the marker. I tested 
with the the second implemention of providing a "collecting stream" that 
skipped the first four bytes if necessary, and it doesn't work well and got 
garbled content when dealing with files that is located in 2 split segments. I 
don't know why it's like this, but I believe it's the `Inflater` in JVM has 
taken the marker into consideration.
   
   I will push the part of `ZipArchiveInputStream` and corresponding testcases 
in my branch today.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334674)
Time Spent: 1h  (was: 50m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-27 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334620=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334620
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 27/Oct/19 11:38
Start Date: 27/Oct/19 11:38
Worklog Time Spent: 10m 
  Work Description: bodewig commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-546686157
 
 
   Many thanks @PeterAlfreadLee I'll need some time to fully review the PR.
   
   As for `ZipArchiveInputStream` I completely agree with you that (virtually) 
concatenating the files into single stream should be almost enough. We'd need a 
way to deal with section 8.5.3 of 
https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT as 
`zipArchiveInputStream` currently rejects files with the split marker 
https://github.com/apache/commons-compress/blob/205876d6f9eb60ac31f3ec848b23d025f32995ab/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java#L370
 . We could either allow people using `ZipArchiveInputStream` to signal it 
should skip the marker or provide a "collecting stream" that skipped the first 
four bytes if necessary.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334620)
Time Spent: 50m  (was: 40m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334504=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334504
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 26/Oct/19 08:52
Start Date: 26/Oct/19 08:52
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545874938
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/26565097/badge)](https://coveralls.io/builds/26565097)
   
   Coverage decreased (-0.06%) to 86.694% when pulling 
**444970ce5f441e1ff0224339c9b524fa9075de8b on PeterAlfreadLee:COMPRESS_477** 
into **205876d6f9eb60ac31f3ec848b23d025f32995ab on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334504)
Time Spent: 0.5h  (was: 20m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=334505=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334505
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 26/Oct/19 08:52
Start Date: 26/Oct/19 08:52
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545874938
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/26565097/badge)](https://coveralls.io/builds/26565097)
   
   Coverage decreased (-0.03%) to 86.719% when pulling 
**444970ce5f441e1ff0224339c9b524fa9075de8b on PeterAlfreadLee:COMPRESS_477** 
into **205876d6f9eb60ac31f3ec848b23d025f32995ab on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 334505)
Time Spent: 40m  (was: 0.5h)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-24 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=333400=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-333400
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 24/Oct/19 13:29
Start Date: 24/Oct/19 13:29
Worklog Time Spent: 10m 
  Work Description: PeterAlfreadLee commented on issue #84: COMPRESS-477 
Add support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545918376
 
 
   I‘m not sure if I need to add the zip split support for 
`ZipArchiveInputStream`.
   
   It seems the `ZipArchiveInputStream` just ignored the Central Directory 
Header and the End Of Central Directory Record. It just read the Local File 
Header and extract file by file.
   
   Support for zip split of `ZipArchiveInputStream` seems pretty easy : just 
create an input stream that combine all zip split segments and ignore the first 
4 bytes of Zip Split Signature.
   
   Please let me know if I need to add the support for splitted zip of 
`ZipArchiveInputStream`
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 333400)
Time Spent: 20m  (was: 10m)

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (COMPRESS-477) Support for splitted zip files

2019-10-24 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-477?focusedWorklogId=12=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-12
 ]

ASF GitHub Bot logged work on COMPRESS-477:
---

Author: ASF GitHub Bot
Created on: 24/Oct/19 11:29
Start Date: 24/Oct/19 11:29
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #84: COMPRESS-477 Add 
support for extracting splitted zip files
URL: https://github.com/apache/commons-compress/pull/84#issuecomment-545874938
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/26522124/badge)](https://coveralls.io/builds/26522124)
   
   Coverage decreased (-0.3%) to 86.427% when pulling 
**bc9c1f1d859db14b1f8dac28364ac06047597bcc on PeterAlfreadLee:COMPRESS_477** 
into **205876d6f9eb60ac31f3ec848b23d025f32995ab on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 12)
Remaining Estimate: 0h
Time Spent: 10m

> Support for splitted zip files
> --
>
> Key: COMPRESS-477
> URL: https://issues.apache.org/jira/browse/COMPRESS-477
> Project: Commons Compress
>  Issue Type: New Feature
>  Components: Archivers
>Affects Versions: 1.18
>Reporter: Luís Filipe Nassif
>Priority: Major
>  Labels: zip
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> It would be very useful to support splitted zip files. I've read 
> [https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT] and understood 
> that simply concatenating the segments and removing the split signature 
> 0x08074b50 from first segment would be sufficient, but it is not that simple 
> because compress fails with exception below:
> {code}
> Caused by: java.util.zip.ZipException: archive's ZIP64 end of central 
> directory locator is corrupt.
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory64(ZipFile.java:924)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:901)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:621)
>  ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:295) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:280) 
> ~[commons-compress-1.18.jar:1.18]
>  at 
> org.apache.commons.compress.archivers.zip.ZipFile.(ZipFile.java:236) 
> ~[commons-compress-1.18.jar:1.18]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)