public final class JkPathFile
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
assertExist() |
JkPathFile |
checksum(java.lang.String... algorithms)
Produces a files, in the same directory, that contains the checksum of this file.
|
JkPathFile |
copyReplacingTokens(java.nio.file.Path to,
java.util.Map<java.lang.String,java.lang.String> tokens,
java.nio.charset.Charset charset)
Creates a copy of this file replacing all occurrences of specified map keys by their matching value.
|
JkPathFile |
copyToDir(java.nio.file.Path dir,
java.nio.file.CopyOption... options)
Copies this file to the specified directory.
|
JkPathFile |
createIfNotExist()
Creates a file at this location if such file does not exist yet.
|
JkPathFile |
deleteIfExist()
Deletes this file if exists.
|
boolean |
exists()
Returns
true if a file already exists at this location. |
JkPathFile |
fetchContentFrom(java.net.URL url)
Copies the content of the specified url into this files, replacing the previous content.
|
java.nio.file.Path |
get()
Returns the underlying path.
|
java.lang.String |
getChecksum(java.lang.String algorithm)
Returns a ASCII string representation of the checksum of this file for the specified algorithm.
|
java.lang.String |
getExtension() |
JkPathFile |
move(java.nio.file.Path to,
java.nio.file.CopyOption... options) |
static JkPathFile |
of(java.nio.file.Path path)
Creates a
instance from the specified path. |
static JkPathFile |
of(java.lang.String path) |
static JkPathFile |
of(java.net.URL url) |
JkPathFile |
setPosixExecPermissions() |
JkPathFile |
setPosixExecPermissions(boolean owner,
boolean group,
boolean other)
Adds execute permition on this files.
|
java.lang.String |
toString() |
JkPathFile |
write(byte[] bytes,
java.nio.file.OpenOption... options)
Shorthand for
Files.write(Path, byte[], OpenOption...) |
public static JkPathFile of(java.nio.file.Path path)
instance from the specified path.
public static JkPathFile of(java.lang.String path)
public static JkPathFile of(java.net.URL url)
public java.nio.file.Path get()
public JkPathFile createIfNotExist()
public JkPathFile copyReplacingTokens(java.nio.file.Path to, java.util.Map<java.lang.String,java.lang.String> tokens, java.nio.charset.Charset charset)
public JkPathFile copyToDir(java.nio.file.Path dir, java.nio.file.CopyOption... options)
public JkPathFile move(java.nio.file.Path to, java.nio.file.CopyOption... options)
public JkPathFile fetchContentFrom(java.net.URL url)
public boolean exists()
true
if a file already exists at this location.public JkPathFile deleteIfExist()
public java.lang.String getChecksum(java.lang.String algorithm)
algorithm
- Hashing algorithm as MD5, SHA-2, ...public JkPathFile write(byte[] bytes, java.nio.file.OpenOption... options)
Files.write(Path, byte[], OpenOption...)
public JkPathFile checksum(java.lang.String... algorithms)
public JkPathFile setPosixExecPermissions(boolean owner, boolean group, boolean other)
public JkPathFile setPosixExecPermissions()
public void assertExist()
public java.lang.String getExtension()
public java.lang.String toString()
toString
in class java.lang.Object