Skip to content

Commit

Permalink
Adding missing documentation for some methods, fixing typos and remov…
Browse files Browse the repository at this point in the history
…ing unnecessary blank spaces/lines. Related to #6 and #20.
  • Loading branch information
Rodrigo Alves Vieira committed Apr 27, 2013
1 parent a8a99b0 commit 6e078ca
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import br.ufpe.cin.groundhog.Config;

/**
* Singleton class to extract files and recursively extract all files within an hierarchy of folders.
* Singleton class to extract files and recursively extract all files within a hierarchy of folders.
* Supports some of the most popular compression formats: .zip, .tar.gz, .tgz, .tar.bz2, .tar.bzip2, .tar.lzma, .tlzma, .rar, .tar
* @author fjsj
*
Expand Down
6 changes: 5 additions & 1 deletion src/java/main/br/ufpe/cin/groundhog/extractor/Formats.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ public static Formats getInstance() {
private Formats() {
String[] extensionsStr = { ".zip", ".tar.gz", ".tgz", ".tar.bz2",
".tar.bzip2", ".tar.lzma", ".tlzma", ".rar", ".tar" };
extensions = Arrays.asList(extensionsStr);
this.extensions = Arrays.asList(extensionsStr);
}

/**
* Tell if the given extension is supported
* @param extension the given extension (e.g. zip, rar)
*/
public boolean isCompatible(String extension) {
for (String ext : extensions) {
if (extension.endsWith(ext)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// Adapted from: https://github.com/edmund-wagner/junrar/blob/6f32323c983015d96c64084418793853f514b519/testutil/src/main/java/de/innosystec/unrar/testutil/ExtractArchive.java
// Original author: edmund wagner
public class RarUncompressor {

private static Log logger = LogFactory.getLog(RarUncompressor.class
.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ public class UncompressNotSupportedException extends GroundhogException {

public UncompressNotSupportedException(String msg) {
super(msg);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

import java.io.File;


public interface Uncompressor {

public Type getType();

public void uncompress(File file);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

public class ZipUncompressor {

/**
* Extracts a zip file to a directory
* @param zipFile a File object representing the zip file to be extracted
* @param dir a File object representing the path to which the zip file will be extracted
*/
public static void extract(File zipFile, File dir) throws IOException {
ZipFile zip = null;
File currentFile = null;
Expand All @@ -24,9 +29,9 @@ public static void extract(File zipFile, File dir) throws IOException {
dir.mkdirs();
}
if (!dir.exists() || !dir.isDirectory()) {
throw new IOException("The directory is no a valid one: "
throw new IOException("The directory is not a valid one: "
+ dir.getName()
+ ". Check if it exists and it is really a directory.");
+ ". Check if it both exists and is really a directory.");
}

zip = new ZipFile(zipFile);
Expand All @@ -45,7 +50,7 @@ public static void extract(File zipFile, File dir) throws IOException {
continue;
}

// if the directory is inexistent, create
// if the directory is inexistent, create it
if (!currentFile.getParentFile().exists()) {
currentFile.getParentFile().mkdirs();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ protected void configure() {
bind(SearchGoogleCode.class).in(Singleton.class);
bind(SearchSourceForge.class).in(Singleton.class);
}
}
}

0 comments on commit 6e078ca

Please sign in to comment.