Java Path File Name nio getContentPath(Path zipFilePath, String contentFileName)

Here you can find the source of getContentPath(Path zipFilePath, String contentFileName)

Description

get Content Path

License

Open Source License

Declaration

@Nullable
    static Path getContentPath(Path zipFilePath, String contentFileName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import javax.annotation.Nullable;

public class Main {
    @Nullable
    static Path getContentPath(Path zipFilePath, String contentFileName) {
        try {// ww w.  jav  a2  s. c o  m
            FileSystem zipFile = FileSystems.newFileSystem(zipFilePath, null);
            Path packagedPath = zipFile.getPath(contentFileName);
            if (Files.exists(packagedPath)) {
                return packagedPath;
            } else {
                return null;
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. getArtifactName(Path artifactPath)
  2. getBandNameStr(Path filePath)
  3. getClassName(Path pluginImplementationDirectory, Path classFile)
  4. getConfigurationFile(String installPath, String serverName)
  5. getConfigurationFilePath(String name)
  6. getDatabaseDirectoryPath(String databaseDirectory, String name)
  7. getDataPath(String filename)
  8. getDeckNameFromFile(final Path deckFile)
  9. getDefaultPathName(final String address, final long lspId)