public class NIOTool extends Object
Constructor and Description |
---|
NIOTool() |
Modifier and Type | Method and Description |
---|---|
boolean |
exists(Path path,
LinkOption... options)
|
Object |
getAttribute(Path path,
String attribute,
LinkOption... options)
|
FileTime |
getLastModifiedTime(Path path,
LinkOption... options)
|
boolean |
isDirectory(Path path,
LinkOption... options)
|
boolean |
isReadable(Path path)
|
boolean |
isRegularFile(Path path,
LinkOption... options)
|
boolean |
isSymbolicLink(Path path)
|
BufferedReader |
newBufferedReader(Path path,
Charset cs)
|
DirectoryStream<Path> |
newDirectoryStream(Path dir)
|
DirectoryStream<Path> |
newDirectoryStream(Path dir,
DirectoryStream.Filter filter)
|
DirectoryStream<Path> |
newDirectoryStream(Path dir,
String glob)
|
byte[] |
readAllBytes(Path path)
|
List<String> |
readAllLines(Path path,
Charset cs)
|
Map<String,Object> |
readAttributes(Path path,
String attributes,
LinkOption... options)
|
long |
size(Path path)
See
Files.size(Path) . |
public DirectoryStream<Path> newDirectoryStream(Path dir)
Files.newDirectoryStream(Path)
.
Velocity Example:
#set ($dirStream = $niotool.newDirectoryStream("attach:Sandbox.WebHome@vma.txt.zip/"))
#foreach ($entry in $dirStream)
* {{{$entry}}}
#end
dir
- See Files.newDirectoryStream(Path)
Files.newDirectoryStream(Path)
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter filter)
dir
- See Files.newDirectoryStream(Path, DirectoryStream.Filter)
filter
- See Files.newDirectoryStream(Path, DirectoryStream.Filter)
Files.newDirectoryStream(Path, DirectoryStream.Filter)
public DirectoryStream<Path> newDirectoryStream(Path dir, String glob)
dir
- See Files.newDirectoryStream(Path, String)
glob
- See Files.newDirectoryStream(Path, String)
Files.newDirectoryStream(Path, String)
public boolean isDirectory(Path path, LinkOption... options)
path
- See Files.isDirectory(Path, LinkOption...)
options
- See Files.isDirectory(Path, LinkOption...)
Files.isDirectory(Path, LinkOption...)
public boolean isRegularFile(Path path, LinkOption... options)
path
- See Files.isRegularFile(Path, LinkOption...)
options
- See Files.isRegularFile(Path, LinkOption...)
Files.isRegularFile(Path, LinkOption...)
public boolean isReadable(Path path)
path
- See Files.isReadable(Path)
Files.isReadable(Path)
public boolean isSymbolicLink(Path path)
path
- See Files.isSymbolicLink(Path)
Files.isSymbolicLink(Path)
public boolean exists(Path path, LinkOption... options)
path
- See Files.exists(Path, LinkOption...)
options
- See Files.exists(Path, LinkOption...)
Files.exists(Path, LinkOption...)
public byte[] readAllBytes(Path path)
Files.readAllBytes(Path)
.
Velocity Example:
$stringtool.toString($niotool.readAllBytes("attach:Sandbox.WebHome@vma.txt.zip/vma.txt"), "utf-8")
path
- See Files.readAllBytes(Path)
Files.readAllBytes(Path)
public List<String> readAllLines(Path path, Charset cs)
path
- See Files.readAllLines(Path, Charset)
cs
- See Files.readAllLines(Path, Charset)
Files.readAllLines(Path, Charset)
public BufferedReader newBufferedReader(Path path, Charset cs)
path
- See Files.newBufferedReader(Path, Charset)
cs
- See Files.newBufferedReader(Path, Charset)
Files.newBufferedReader(Path, Charset)
public long size(Path path)
Files.size(Path)
.path
- See Files.size(Path)
Files.size(Path)
public Object getAttribute(Path path, String attribute, LinkOption... options)
path
- See Files.getAttribute(Path, String, LinkOption...)
attribute
- See Files.getAttribute(Path, String, LinkOption...)
options
- See Files.getAttribute(Path, String, LinkOption...)
Files.getAttribute(Path, String, LinkOption...)
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options)
path
- See Files.readAttributes(Path, String, LinkOption...)
attributes
- See Files.readAttributes(Path, String, LinkOption...)
options
- See Files.readAttributes(Path, String, LinkOption...)
Files.readAttributes(Path, String, LinkOption...)
public FileTime getLastModifiedTime(Path path, LinkOption... options)
path
- See Files.getLastModifiedTime(Path, LinkOption...)
options
- See Files.getLastModifiedTime(Path, LinkOption...)
Files.getLastModifiedTime(Path, LinkOption...)
Copyright © 2004–2019 XWiki. All rights reserved.