Here you can find the source of jobNameFromPath(Path path)
Parameter | Description |
---|---|
path | Path |
public static String jobNameFromPath(Path path)
//package com.java2s; /**/*from www . j ava2 s . c o m*/ * Copyright 2015 LinkedIn Corp. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ import java.nio.file.Path; public class Main { /** * Get job name without file extension * @param path Path * @return String */ public static String jobNameFromPath(Path path) { return jobNameFromFileName(path.getFileName().toString()); } /** * Get job name without file extension * @param filename String * @return String */ public static String jobNameFromFileName(String filename) { return filename.substring(0, filename.lastIndexOf('.')); } }