APISonar


com.google.common.io.Files.getNameWithoutExtension

> com > google > common > io > Files > getNameWithoutExtension
com APIs google APIs common APIs io APIs Files APIs getNameWithoutExtension APIs

Example 1
public void validateModuleZipFile(ZipFile moduleFile) {
    checkModuleHasAndroidManifest(
        moduleFile,
        /* moduleBaseDir= */ ZipPath.create(""),
        /* moduleName= */ Files.getNameWithoutExtension(moduleFile.getName()));
  }
Example 2
private String getFileName(String originalFilename) {
        return String.format("%s-%s.%s",
            Files.getNameWithoutExtension(originalFilename),
            FILE_DATE_FORMAT.format(new Date()),
            Files.getFileExtension(originalFilename));
    }
Example 3
private static boolean hasHtmlSibling(File file) {
    File sibling = new File(file.getParentFile(),
        Files.getNameWithoutExtension(file.getAbsolutePath()) + ".html");
    return sibling.exists();
  }
Example 4
public String getName(Function<SourcePath, Path> resolver) {
    String fileName = getFileName(resolver).toString();
    return Files.getNameWithoutExtension(fileName);
  }
Example 5
private File getHashFile(File inputSpecFile) {
        String name = inputSpecFile.getName();

        URL url = inputSpecRemoteUrl();
        if (url != null) {
            String[] segments = url.getPath().split("/");
            name = Files.getNameWithoutExtension(segments[segments.length - 1]);
        }

        return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + name + ".sha256");
    }
Example 6
private static String getJobTemplateName(JobExecutionPlan jobExecutionPlan) {
    Optional<URI> jobTemplateUri = jobExecutionPlan.getJobSpec().getTemplateURI();
    if (jobTemplateUri.isPresent()) {
      return Files.getNameWithoutExtension(new Path(jobTemplateUri.get()).getName());
    } else {
      return null;
    }
  }
Example 7
static String getUniqueContentName(File classpathElement, String contentHash) {
    String fileName = Files.getNameWithoutExtension(classpathElement.getAbsolutePath());
    String fileExtension = Files.getFileExtension(classpathElement.getAbsolutePath());
    if (classpathElement.isDirectory()) {
      return fileName + "-" + contentHash + ".jar";
    } else if (fileExtension.isEmpty()) {
      return fileName + "-" + contentHash;
    }
    return fileName + "-" + contentHash + "." + fileExtension;
  }
Example 8
private static String transformInputToDexOutput(File file, DexStore dexStore) {
    if (DexStore.XZ == dexStore) {
      return Files.getNameWithoutExtension(file.getName()) + ".dex.jar.xz";
    } else {
      return Files.getNameWithoutExtension(file.getName()) + ".dex.jar";
    }
  }
Example 9
public String getFlowName(final File flowFile) {
    checkArgument(flowFile != null && flowFile.exists());
    checkArgument(flowFile.getName().endsWith(Constants.FLOW_FILE_SUFFIX));

    return Files.getNameWithoutExtension(flowFile.getName());
  }
Example 10
private void loadCatalog(File file)
            throws Exception
    {
        Map<String, String> properties = new HashMap<>(loadProperties(file));

        String connectorName = properties.remove("connector.name");
        checkState(connectorName != null, "Catalog configuration %s does not contain conector.name", file.getAbsoluteFile());

        String catalogName = Files.getNameWithoutExtension(file.getName());

        connectorManager.createConnection(catalogName, connectorName, ImmutableMap.copyOf(properties));
        log.info("Added catalog %s using connector %s", catalogName, connectorName);
    }
Example 11
public void simpleDirectoryTest() throws IOException, SegmentLoadingException
  {
    File srcDir = temporaryFolder.newFolder();
    File tmpFile = File.createTempFile("test", "file", srcDir);
    File expectedOutput = new File(tmpDir, Files.getNameWithoutExtension(tmpFile.getAbsolutePath()));
    Assert.assertFalse(expectedOutput.exists());
    puller.getSegmentFiles(srcDir, tmpDir);
    Assert.assertTrue(expectedOutput.exists());
  }
Example 12
public static String getGzBaseName(String fname)
  {
    final String reducedFname = Files.getNameWithoutExtension(fname);
    if (isGz(fname) && !reducedFname.isEmpty()) {
      return reducedFname;
    }
    throw new IAE("[%s] is not a valid gz file name", fname);
  }
Example 13
private synchronized void replaceExtensionsPlist(File installDirectory) throws IOException {
    extensionPlist = new File(installDirectory, "Extensions.plist");
    if (extensionPlist.exists()) {
      backup.backup(extensionPlist);
    }
    // Generate Extensions.plist and save it
    StringBuilder plistContent = new StringBuilder(EXTENSION_PLIST_LINES_HEAD);
    for (File extensionFile : installedExtensions) {
      String basename = Files.getNameWithoutExtension(extensionFile.getName()); // Strip .safariextz
      plistContent.append(String.format(EXTENSION_PLIST_LINES_ITEM, basename, basename));
    }
    plistContent.append(EXTENSION_PLIST_LINES_TAIL);
    write(plistContent.toString(), extensionPlist, Charsets.UTF_8);
  }
Example 14
Path getProguardOutputFromInputClasspath(Path classpathEntry) {
    // Hehe, this is so ridiculously fragile.
    Preconditions.checkArgument(!classpathEntry.isAbsolute(),
        "Classpath entries should be relative rather than absolute paths: %s",
        classpathEntry);
    String obfuscatedName =
        Files.getNameWithoutExtension(classpathEntry.toString()) + "-obfuscated.jar";
    Path dirName = classpathEntry.getParent();
    Path outputJar = getPathForProGuardDirectory().resolve(dirName).resolve(obfuscatedName);
    return outputJar;
  }
Example 15
public static String constructFilePath(String oldFilePath, long recordCounts) {
    return new Path(new Path(oldFilePath).getParent(), Files.getNameWithoutExtension(oldFilePath).toString() + SEPARATOR
        + recordCounts + SEPARATOR + Files.getFileExtension(oldFilePath)).toString();
  }
Example 16
protected LogCopier buildLogCopier(Config config, String containerId, FileSystem destFs, Path appWorkDir)
      throws IOException {
    LogCopier.Builder builder = LogCopier.newBuilder()
            .useSrcFileSystem(buildFileSystem(config, true))
            .useDestFileSystem(buildFileSystem(config, false))
            .readFrom(getLocalLogDirs())
            .writeTo(getHdfsLogDir(containerId, destFs, appWorkDir))
            .useCurrentLogFileName(Files.getNameWithoutExtension(System.getProperty(GobblinYarnConfigurationKeys.GOBBLIN_YARN_CONTAINER_LOG_FILE_NAME)));

    builder.acceptsLogFileExtensions(config.hasPath(GobblinYarnConfigurationKeys.LOG_FILE_EXTENSIONS) ? ImmutableSet
        .copyOf(Splitter.on(",").splitToList(config.getString(GobblinYarnConfigurationKeys.LOG_FILE_EXTENSIONS)))
        : ImmutableSet.of());

    return builder.build();
  }
Example 17
private void saveGroup(@PathVariable String version, String fileName, InputStream in) throws IOException {
        List<PropertyItemVO> items = parseInputFile(in);
        if(!items.isEmpty()) {
            final String group = Files.getNameWithoutExtension(fileName);
            final String dataPath = makePaths(getRoot(), version, group);
            final String commentPath = makePaths(getRoot(), version + COMMENT_SUFFIX, group);

            items.forEach(item -> {
                nodeService.createProperty(makePaths(dataPath, StringUtils.trim(item.getName())), StringUtils.trim(item.getValue()));
                nodeService.createProperty(makePaths(commentPath, StringUtils.trim(item.getName())), StringUtils.trim(item.getComment()));
            });
        }
    }
Example 18
private static String getMLBytecodeOutputName(String name) {
    String base = Files.getNameWithoutExtension(name);
    String ext = Files.getFileExtension(name);
    Preconditions.checkArgument(OCamlCompilables.SOURCE_EXTENSIONS.contains(ext));
    String dotExt = "." + ext;
    if (dotExt.equals(OCamlCompilables.OCAML_ML)) {
      return base + OCamlCompilables.OCAML_CMO;
    } else if (dotExt.equals(OCamlCompilables.OCAML_MLI)) {
      return base + OCamlCompilables.OCAML_CMI;
    } else {
      Preconditions.checkState(false, "Unexpected extension: " + ext);
      return base;
    }
  }
Example 19
private Config getEdgeConfigWithOverrides(Config edgeConfig, Path edgeFilePath) {
    String source = edgeFilePath.getParent().getParent().getName();
    String destination = edgeFilePath.getParent().getName();
    String edgeName = Files.getNameWithoutExtension(edgeFilePath.getName());

    return edgeConfig.withValue(FlowGraphConfigurationKeys.FLOW_EDGE_SOURCE_KEY, ConfigValueFactory.fromAnyRef(source))
        .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_DESTINATION_KEY, ConfigValueFactory.fromAnyRef(destination))
        .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_ID_KEY, ConfigValueFactory.fromAnyRef(getEdgeId(source, destination, edgeName)));
  }