public final class JkPathFile
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
JkPathFile |
addExecPerm(boolean owner,
boolean group,
boolean other)
Adds execute permition on this files.
|
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. |
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.
|
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 |
replaceContentBy(java.net.URL url)
Copies the content of the specified url into this files, replacing the previous content.
|
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 replaceContentBy(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 addExecPerm(boolean owner, boolean group, boolean other)
public void assertExist()