Class CompressedFile

java.lang.Object
com.vividsolutions.jump.io.CompressedFile

public class CompressedFile extends Object
Utility class for dealing with compressed files.
Author:
dblasby, ede
See Also:
  • Constructor Details

    • CompressedFile

      public CompressedFile()
      Creates a new CompressedFile
  • Method Details

    • getInternalZipFnameByExtension

      public static String getInternalZipFnameByExtension(String extension, String compressedFile) throws Exception
      Deprecated.
      only used by very old data readers which only deliver the first file in zip file [ede 05.2012]
      Searches through the .zip file looking for a file with the given extension. Returns null if it doesn't find one.
      Throws:
      Exception
    • listEntries

      public static List<URI> listEntries(File file) throws Exception
      Throws:
      Exception
    • openFile

      public static InputStream openFile(String uri_string) throws URISyntaxException, IOException
      Throws:
      URISyntaxException
      IOException
    • openFile

      public static InputStream openFile(URI uri) throws IOException
      Throws:
      IOException
    • openFile

      public static InputStream openFile(String filePath, String compressedEntry) throws IOException
      Utility file open function - handles compressed and un-compressed files.
      Parameters:
      filePath - name of the file to search for.
      compressedEntry - name of the compressed file.

      If compressedEntry = null, opens a FileInputStream on filePath

      If filePath ends in ".zip" - opens the compressed Zip and looks for the file called compressedEntry

      If filePath ends in ".gz" - opens the compressed .gz file.

      Throws:
      IOException
    • isCompressed

      public static boolean isCompressed(URI uri)
    • isArchive

      public static boolean isArchive(URI uri)
    • isCompressed

      public static boolean isCompressed(String filePath)
    • isArchive

      public static boolean isArchive(String filePath)
    • isZip

      public static boolean isZip(String filePath)
    • isTar

      public static boolean isTar(String filePath)
    • isGZip

      public static boolean isGZip(String filePath)
    • isBZip

      public static boolean isBZip(String filePath)
    • isXZ

      public static boolean isXZ(String filePath)
    • isSevenZ

      public static boolean isSevenZ(String filePath)
    • getArchiveExtensions

      public static String[] getArchiveExtensions()
    • getFileExtensions

      public static String[] getFileExtensions()
    • getExtension

      public static String getExtension(String path)
      returns second level extension for compressed files eg. "tif" for "file.tif.gz" all others the first extension eg. "tif" for "file.tif"
      Parameters:
      path - a file path
      Returns:
      the extension for this file
    • hasCompressedFileExtension

      public static boolean hasCompressedFileExtension(String filename)
    • hasArchiveFileExtension

      public static boolean hasArchiveFileExtension(String filename)
    • getTargetFileWithPath

      public static String getTargetFileWithPath(URI uri)
    • replaceTargetFileWithPath

      public static URI replaceTargetFileWithPath(URI uri, String location)
    • replaceTargetFileName

      public static URI replaceTargetFileName(URI uri, String filename)
    • createLayerName

      public static String createLayerName(URI uri)