Skip to content

Commit b3e4a45

Browse files
o Updated to correct issues discussed at pull request 27.
1 parent 85024ec commit b3e4a45

File tree

9 files changed

+602
-587
lines changed

9 files changed

+602
-587
lines changed
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
/*
2-
* Copyright 2016 Codehaus.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package org.codehaus.plexus.archiver.tar;
17-
18-
import java.io.File;
19-
20-
/**
21-
*
22-
* @author philip.lourandos
23-
*/
24-
public class PlexusIoTarXZFileResourceCollection extends
25-
PlexusIoTarFileResourceCollection
26-
{
27-
28-
public PlexusIoTarXZFileResourceCollection()
29-
{
30-
}
31-
32-
@Override
33-
protected TarFile newTarFile(File file)
34-
{
35-
return new XZTarFile( file );
36-
}
37-
}
1+
/*
2+
* Copyright 2016 Codehaus.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.codehaus.plexus.archiver.tar;
17+
18+
import java.io.File;
19+
20+
/**
21+
*
22+
* @author philip.lourandos
23+
*/
24+
public class PlexusIoTarXZFileResourceCollection extends
25+
PlexusIoTarFileResourceCollection
26+
{
27+
28+
public PlexusIoTarXZFileResourceCollection()
29+
{
30+
}
31+
32+
@Override
33+
protected TarFile newTarFile(File file)
34+
{
35+
return new XZTarFile( file );
36+
}
37+
}
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
/*
2-
* Copyright 2016 Codehaus.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package org.codehaus.plexus.archiver.tar;
17-
18-
import java.io.File;
19-
20-
/**
21-
*
22-
* @author philip.lourandos
23-
*/
24-
public class TarXZUnArchiver extends TarUnArchiver
25-
{
26-
public TarXZUnArchiver() {
27-
setupCompressionMethod();
28-
}
29-
30-
public TarXZUnArchiver(File sourceFile) {
31-
super(sourceFile);
32-
33-
setupCompressionMethod();
34-
}
35-
36-
private final void setupCompressionMethod()
37-
{
38-
setCompression(TarUnArchiver.UntarCompressionMethod.XZ);
39-
}
40-
}
1+
/*
2+
* Copyright 2016 Codehaus.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.codehaus.plexus.archiver.tar;
17+
18+
import java.io.File;
19+
20+
/**
21+
*
22+
* @author philip.lourandos
23+
*/
24+
public class TarXZUnArchiver extends TarUnArchiver
25+
{
26+
public TarXZUnArchiver() {
27+
setupCompressionMethod();
28+
}
29+
30+
public TarXZUnArchiver(File sourceFile) {
31+
super(sourceFile);
32+
33+
setupCompressionMethod();
34+
}
35+
36+
private final void setupCompressionMethod()
37+
{
38+
setCompression(TarUnArchiver.UntarCompressionMethod.XZ);
39+
}
40+
}
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
/*
2-
* Copyright 2016 Codehaus.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package org.codehaus.plexus.archiver.tar;
17-
18-
import java.io.File;
19-
import java.io.IOException;
20-
import java.io.InputStream;
21-
import org.codehaus.plexus.archiver.xz.XZUnArchiver;
22-
23-
/**
24-
*
25-
* @author philip.lourandos
26-
*/
27-
public class XZTarFile extends TarFile
28-
{
29-
30-
public XZTarFile ( File file )
31-
{
32-
super(file);
33-
}
34-
35-
@Override
36-
protected InputStream getInputStream( File file ) throws IOException
37-
{
38-
return XZUnArchiver.getXZInputStream( super.getInputStream( file ) );
39-
}
40-
}
1+
/*
2+
* Copyright 2016 Codehaus.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.codehaus.plexus.archiver.tar;
17+
18+
import java.io.File;
19+
import java.io.IOException;
20+
import java.io.InputStream;
21+
import org.codehaus.plexus.archiver.xz.XZUnArchiver;
22+
23+
/**
24+
*
25+
* @author philip.lourandos
26+
*/
27+
public class XZTarFile extends TarFile
28+
{
29+
30+
public XZTarFile ( File file )
31+
{
32+
super(file);
33+
}
34+
35+
@Override
36+
protected InputStream getInputStream( File file ) throws IOException
37+
{
38+
return XZUnArchiver.getXZInputStream( super.getInputStream( file ) );
39+
}
40+
}
Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,56 @@
1-
/*
2-
* Copyright 2016 Codehaus.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package org.codehaus.plexus.archiver.xz;
17-
18-
import java.io.File;
19-
import java.io.FileInputStream;
20-
import java.io.IOException;
21-
import java.io.InputStream;
22-
import java.util.HashMap;
23-
import org.codehaus.plexus.components.io.attributes.Java7FileAttributes;
24-
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
25-
import org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
26-
27-
/**
28-
*
29-
* @author lore
30-
*/
31-
public class PlexusIoXZResourceCollection extends PlexusIoCompressedFileResourceCollection {
32-
33-
@Override
34-
protected PlexusIoResourceAttributes getAttributes(File file) throws IOException {
35-
return new Java7FileAttributes(file, new HashMap<Integer, String>(), new HashMap<Integer, String>());
36-
}
37-
38-
@Override
39-
protected String getDefaultExtension() {
40-
return ".xz";
41-
}
42-
43-
@Override
44-
protected InputStream getInputStream(File file) throws IOException {
45-
FileInputStream fileIs = new FileInputStream(file);
46-
47-
return XZUnArchiver.getXZInputStream(fileIs);
48-
49-
}
50-
}
1+
/*
2+
* Copyright 2016 Codehaus.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.codehaus.plexus.archiver.xz;
17+
18+
import java.io.File;
19+
import java.io.FileInputStream;
20+
import java.io.IOException;
21+
import java.io.InputStream;
22+
import java.util.HashMap;
23+
import org.codehaus.plexus.components.io.attributes.Java7FileAttributes;
24+
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
25+
import org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
26+
import org.codehaus.plexus.util.IOUtil;
27+
28+
/**
29+
*
30+
* @author lore
31+
*/
32+
public class PlexusIoXZResourceCollection extends PlexusIoCompressedFileResourceCollection {
33+
34+
@Override
35+
protected PlexusIoResourceAttributes getAttributes(File file) throws IOException {
36+
return new Java7FileAttributes(file, new HashMap<Integer, String>(), new HashMap<Integer, String>());
37+
}
38+
39+
@Override
40+
protected String getDefaultExtension() {
41+
return ".xz";
42+
}
43+
44+
@Override
45+
protected InputStream getInputStream(File file) throws IOException {
46+
FileInputStream fileIs = new FileInputStream(file);
47+
try {
48+
final InputStream result = XZUnArchiver.getXZInputStream( fileIs );
49+
fileIs = null;
50+
return result;
51+
}
52+
finally {
53+
IOUtil.close(fileIs);
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)