| Modifier and Type | Field and Description |
|---|---|
| private final Map | compressSuffix
Map from common file name suffixes to the suffixes that identify compressed versions of those file types. |
| private final String | defaultExtension
The format's default extension. |
| private final int | longestCompressedSuffix
Length of the longest compressed suffix. |
| private final int | longestUncompressedSuffix
Length of the longest uncompressed suffix. |
| private final int | shortestCompressedSuffix
Length of the shortest compressed suffix. |
| private final int | shortestUncompressedSuffix
Length of the shortest uncompressed suffix longer than the empty string. |
| private final Map | uncompressSuffix
Map from common file name suffixes of compressed files to the corresponding suffixes of uncompressed files. |
| Access | Constructor and Description |
|---|---|
| public | FileNameUtil(final Map<String, String>
Map from common file name suffixes of compressed files to the corresponding suffixes of uncompressed files. For example: from
".tgz" to ".tar". This map also contains format-specific suffixes like ".gz" and "-z". These suffixes are mapped to the empty
string, as they should simply be removed from the file name when the file is uncompressed. uncompressSuffix, final String the format's default extension like ".gz" defaultExtension)sets up the utility with a map of known compressed to uncompressed suffix mappings and the default extension of the format. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: name of the corresponding compressed filename of a file fileName)
Deprecated
Use
Maps the given file name to the name that the file should have after compression.
getCompressedFileName(String).
|
| public String | Returns: name of the corresponding compressed filename of a file fileName)Maps the given file name to the name that the file should have after compression. |
| public String | Returns: name of the corresponding uncompressed filename of a file fileName)
Deprecated
Use
Maps the given name of a compressed file to the name that the file should have after uncompression.
getUncompressedFileName(String).
|
| public String | Returns: name of the corresponding uncompressed filename of a file fileName)Maps the given name of a compressed file to the name that the file should have after uncompression. |
| public boolean | Returns: true if the file name has a common format suffix, false otherwisename of a file fileName)
Deprecated
Use
Detects common format suffixes in the given file name.
isCompressedFileName(String).
|
| public boolean | Returns: true if the file name has a common format suffix, false otherwisename of a file fileName)Detects common format suffixes in the given file name. |
| compressSuffix | back to summary |
|---|---|
| private final Map<String, String> compressSuffix Map from common file name suffixes to the suffixes that identify compressed versions of those file types. For example: from ".tar" to ".tgz". | |
| defaultExtension | back to summary |
|---|---|
| private final String defaultExtension The format's default extension. | |
| longestCompressedSuffix | back to summary |
|---|---|
| private final int longestCompressedSuffix Length of the longest compressed suffix. | |
| longestUncompressedSuffix | back to summary |
|---|---|
| private final int longestUncompressedSuffix Length of the longest uncompressed suffix. | |
| shortestCompressedSuffix | back to summary |
|---|---|
| private final int shortestCompressedSuffix Length of the shortest compressed suffix. | |
| shortestUncompressedSuffix | back to summary |
|---|---|
| private final int shortestUncompressedSuffix Length of the shortest uncompressed suffix longer than the empty string. | |
| uncompressSuffix | back to summary |
|---|---|
| private final Map<String, String> uncompressSuffix Map from common file name suffixes of compressed files to the corresponding suffixes of uncompressed files. For example: from ".tgz" to ".tar". This map also contains format-specific suffixes like ".gz" and "-z". These suffixes are mapped to the empty string, as they should simply be removed from the file name when the file is uncompressed. | |
| FileNameUtil | back to summary |
|---|---|
| public FileNameUtil(final Map<String, String> uncompressSuffix, final String defaultExtension) sets up the utility with a map of known compressed to uncompressed suffix mappings and the default extension of the format.
| |
| getCompressedFilename | back to summary |
|---|---|
| public String getCompressedFilename(final String fileName)
Deprecated Maps the given file name to the name that the file should have after compression. Common file types with custom suffixes for compressed versions are automatically detected and correctly mapped. For example the name "package.tar" is mapped to "package.tgz". If no custom mapping is applicable, then the default ".gz" suffix is appended to the file name. | |
| getCompressedFileName | back to summary |
|---|---|
| public String getCompressedFileName(final String fileName) Maps the given file name to the name that the file should have after compression. Common file types with custom suffixes for compressed versions are automatically detected and correctly mapped. For example the name "package.tar" is mapped to "package.tgz". If no custom mapping is applicable, then the default ".gz" suffix is appended to the file name. | |
| getUncompressedFilename | back to summary |
|---|---|
| public String getUncompressedFilename(final String fileName)
Deprecated Maps the given name of a compressed file to the name that the file should have after uncompression. Commonly used file type specific suffixes like ".tgz" or ".svgz" are automatically detected and correctly mapped. For example the name "package.tgz" is mapped to "package.tar". And any file names with the generic ".gz" suffix (or any other generic gzip suffix) is mapped to a name without that suffix. If no format suffix is detected, then the file name is returned unmapped. | |
| getUncompressedFileName | back to summary |
|---|---|
| public String getUncompressedFileName(final String fileName) Maps the given name of a compressed file to the name that the file should have after uncompression. Commonly used file type specific suffixes like ".tgz" or ".svgz" are automatically detected and correctly mapped. For example the name "package.tgz" is mapped to "package.tar". And any file names with the generic ".gz" suffix (or any other generic gzip suffix) is mapped to a name without that suffix. If no format suffix is detected, then the file name is returned unmapped. | |
| isCompressedFilename | back to summary |
|---|---|
| public boolean isCompressedFilename(final String fileName)
Deprecated Detects common format suffixes in the given file name.
| |
| isCompressedFileName | back to summary |
|---|---|
| public boolean isCompressedFileName(final String fileName) Detects common format suffixes in the given file name.
| |