本文整理了Java中java.nio.file.Path.toString()
方法的一些代码示例,展示了Path.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.toString()
方法的具体详情如下:
包路径:java.nio.file.Path
类名称:Path
方法名:toString
暂无
代码示例来源:origin: spring-projects/spring-framework
/**
* This implementation returns the name of the file.
* @see java.nio.file.Path#getFileName()
*/
@Override
public String getFilename() {
return this.path.getFileName().toString();
}
代码示例来源:origin: neo4j/neo4j
CannotWriteException( Path file )
{
super( format( "Could not write to: %s", file.toAbsolutePath().toString() ) );
}
}
代码示例来源:origin: perwendel/spark
private static String unixifyPath(String path) {
return Paths.get(path).toAbsolutePath().toString().replace("\\", "/");
}
代码示例来源:origin: wildfly/wildfly
private Path tempPath() {
Path parent = path.getParent();
File file = parent.toFile();
if (!file.exists()) {
file.mkdirs();
}
return parent.resolve(path.getFileName().toString() + '.' + tempSuffix());
}
代码示例来源:origin: apache/zeppelin
static String resolveLocalRepoPath(String localRepoPath) {
// todo decouple home folder resolution
// find homedir
String home = System.getenv("ZEPPELIN_HOME");
if (home == null) {
home = System.getProperty("zeppelin.home");
}
if (home == null) {
home = "..";
}
return Paths.get(home).resolve(localRepoPath).toAbsolutePath().toString();
}
代码示例来源:origin: AdoptOpenJDK/jitwatch
public JavapProcess() throws FileNotFoundException
{
super();
Path javaHome = Paths.get(System.getProperty("java.home"));
executablePath = Paths.get(javaHome.toString(), "..", "bin", EXECUTABLE_NAME);
if (!executablePath.toFile().exists())
{
executablePath = Paths.get(javaHome.toString(), "bin", EXECUTABLE_NAME);
if (!executablePath.toFile().exists())
{
throw new FileNotFoundException("Could not find " + EXECUTABLE_NAME);
}
}
executablePath = executablePath.normalize();
}
代码示例来源:origin: apache/incubator-druid
@Override
public boolean apply(@Nullable URL input)
{
try {
if (input == null) {
return false;
}
final String fName = Paths.get(input.toURI()).getFileName().toString();
return fName.startsWith("druid") && fName.endsWith(".jar") && !fName.endsWith("selfcontained.jar");
}
catch (URISyntaxException e) {
throw Throwables.propagate(e);
}
}
};
代码示例来源:origin: pxb1988/dex2jar
@Override
public void visitFile(Path file, String relative) throws IOException {
if (file.getFileName().toString().endsWith(".class")) {
Files.copy(file, outRoot.resolve(relative));
}
}
});
代码示例来源:origin: Tencent/tinker
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path relativePath = oldApkPath.relativize(file);
Path newPath = newApkPath.resolve(relativePath);
String patternKey = relativePath.toString().replace("\\", "/");
if (Utils.checkFileInPattern(config.mResFilePattern, patternKey)) {
//not contain in new path, is deleted
if (!newPath.toFile().exists()) {
deletedFiles.add(patternKey);
writeResLog(newPath.toFile(), file.toFile(), TypedValue.DEL);
}
return FileVisitResult.CONTINUE;
}
return FileVisitResult.CONTINUE;
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public File[] listFiles( File directory, final FilenameFilter filter )
{
try ( Stream<Path> listing = Files.list( path( directory ) ) )
{
return listing
.filter( entry -> filter.accept( entry.getParent().toFile(), entry.getFileName().toString() ) )
.map( Path::toFile )
.toArray( File[]::new );
}
catch ( IOException e )
{
return null;
}
}
代码示例来源:origin: apache/incubator-druid
private String defaultDir(String configParameter, final String defaultVal)
{
if (configParameter == null) {
return Paths.get(getBaseDir(), defaultVal).toString();
}
return configParameter;
}
}
代码示例来源:origin: twosigma/beakerx
private String getSparkexJar() {
try {
Path path = Paths.get(EnableSparkSupportMagicCommand.class.getProtectionDomain().getCodeSource().getLocation().toURI());
return path.getParent().getParent().getParent().resolve("sparkex").resolve("lib").resolve("sparkex.jar").toString();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: neo4j/neo4j
private ArchiveEntry createEntry( Path file, Path root, ArchiveOutputStream archive ) throws IOException
{
return archive.createArchiveEntry( file.toFile(), "./" + root.relativize( file ).toString() );
}
代码示例来源:origin: guoguibing/librec
/**
* @return the name of current folder
*/
public static String getCurrentFolder() {
return Paths.get("").toAbsolutePath().getFileName().toString();
}
代码示例来源:origin: apache/flink
public void stopFlinkCluster() throws IOException {
AutoClosableProcess.runBlocking("Stop Flink Cluster", bin.resolve("stop-cluster.sh").toAbsolutePath().toString());
}
代码示例来源:origin: neo4j/neo4j
public static String getRelativePath( File folder, Setting<File> setting )
{
return folder.toPath().resolve( setting.getDefaultValue() ).toString();
}
代码示例来源:origin: apache/nifi
/**
* Setup a file to archive data flow. Create archive directory if it doesn't exist yet.
* @return Resolved archive file which is ready to write to
* @throws IOException when it fails to access archive dir
*/
public File setupArchiveFile() throws IOException {
Files.createDirectories(archiveDir);
if (!Files.isDirectory(archiveDir)) {
throw new IOException("Archive directory doesn't appear to be a directory " + archiveDir);
}
final String originalFlowConfigFileName = flowConfigFile.getFileName().toString();
final Path archiveFile = archiveDir.resolve(createArchiveFileName(originalFlowConfigFileName));
return archiveFile.toFile();
}
代码示例来源:origin: embulk/embulk
private String buildGemfilePath(final String bundleDirectoryString) throws ProvisionException {
final Path bundleDirectory;
try {
bundleDirectory = Paths.get(bundleDirectoryString);
} catch (InvalidPathException ex) {
throw new ProvisionException("Bundle directory is invalid: \"" + bundleDirectoryString + "\"", ex);
}
return bundleDirectory.toAbsolutePath().resolve("Gemfile").toString();
}
代码示例来源:origin: KronicDeth/intellij-elixir
private static void addSourcePath(@NotNull SdkModificator sdkModificator, @NotNull Path ebinPath) {
Path parentPath = ebinPath.getParent();
Path libPath = Paths.get(parentPath.toString(), "lib");
File libFile = libPath.toFile();
if (libFile.exists()) {
addSourcePath(sdkModificator, libFile);
}
}
代码示例来源:origin: neo4j/neo4j
private static Path determineEntryDestination( ArchiveEntry entry, Path databaseDestination,
Path transactionLogsDirectory )
{
String entryName = Paths.get( entry.getName() ).getFileName().toString();
return TransactionLogFiles.DEFAULT_FILENAME_FILTER.accept( null, entryName ) ? transactionLogsDirectory
: databaseDestination;
}
内容来源于网络,如有侵权,请联系作者删除!