-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from ate47/hcat_tree_external
HDTCatTree + HDTGenDisk
- Loading branch information
Showing
231 changed files
with
19,035 additions
and
2,108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
hdt-api/src/main/java/org/rdfhdt/hdt/enums/CompressionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.rdfhdt.hdt.enums; | ||
|
||
/** | ||
* A compression type | ||
* @author Antoine Willerval | ||
*/ | ||
public enum CompressionType { | ||
|
||
/** | ||
* gzip compression (.gz .tgz) | ||
*/ | ||
GZIP("gz", "tgz"), | ||
/** | ||
* bzip compression (.bz2 .bz) | ||
*/ | ||
BZIP("bz2", "bz"), | ||
/** | ||
* bzip compression (.xz) | ||
*/ | ||
XZ("xz"), | ||
/** | ||
* no compression | ||
*/ | ||
NONE; | ||
|
||
/** | ||
* try to guess a compression of a file with its name | ||
* @param fileName the file name to guess | ||
* @return the compression type or none if it can't be guessed | ||
*/ | ||
public static CompressionType guess(String fileName) { | ||
String str = fileName.toLowerCase(); | ||
|
||
int idx = str.lastIndexOf('.'); | ||
if(idx!=-1) { | ||
String ext = str.substring(idx + 1); | ||
for (CompressionType type: values()) { | ||
for (String typeExt : type.ext) { | ||
if (typeExt.equals(ext)) { | ||
return type; | ||
} | ||
} | ||
} | ||
} | ||
return NONE; | ||
} | ||
|
||
private final String[] ext; | ||
CompressionType(String... ext) { | ||
this.ext = ext; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.