Package | Description |
---|---|
nl.esciencecenter.xenon.files |
This package contains classes and interfaces for manipulating files.
|
nl.esciencecenter.xenon.util |
This package is contains several utility classes.
|
Modifier and Type | Method and Description |
---|---|
Path |
FileSystem.getEntryPath()
Get the entry path of this file system.
|
Path |
Copy.getSource()
Retrieve the source of the copy.
|
Path |
Copy.getTarget()
Retrieve the target of the copy.
|
Path |
Files.newPath(FileSystem filesystem,
RelativePath location)
Create a new Path that represents a (possibly non existing) location on
filesystem. |
Path |
PathAttributesPair.path()
Get the Path in this PathAttributesPair.
|
Path |
Files.readSymbolicLink(Path link)
Reads the target of a symbolic link (optional operation).
|
Modifier and Type | Method and Description |
---|---|
DirectoryStream<Path> |
Files.newDirectoryStream(Path dir)
Create a DirectoryStream that iterates over all entries in the directory
dir . |
DirectoryStream<Path> |
Files.newDirectoryStream(Path dir,
DirectoryStream.Filter filter)
Create a DirectoryStream that iterates over all entries in the directory
dir that are accepted by the filter. |
Modifier and Type | Method and Description |
---|---|
boolean |
DirectoryStream.Filter.accept(Path entry)
Decide if the entry should be accepted.
|
Copy |
Files.copy(Path source,
Path target,
CopyOption... options)
Copy an existing source file or symbolic link to a target file.
|
void |
Files.createDirectories(Path dir)
Creates a new directory, failing if the directory already exists.
|
void |
Files.createDirectory(Path dir)
Creates a new directory, failing if the directory already exists.
|
void |
Files.createFile(Path path)
Creates a new empty file, failing if the file already exists.
|
void |
Files.delete(Path path)
Deletes an existing path.
|
boolean |
Files.exists(Path path)
Tests if a path exists.
|
FileAttributes |
Files.getAttributes(Path path)
Get the
FileAttributes of an existing path. |
void |
Files.move(Path source,
Path target)
Move or rename an existing source path to a non-existing target path.
|
DirectoryStream<PathAttributesPair> |
Files.newAttributesDirectoryStream(Path dir)
Create a DirectoryStream that iterates over all PathAttributePair entries in the directory
dir . |
DirectoryStream<PathAttributesPair> |
Files.newAttributesDirectoryStream(Path dir,
DirectoryStream.Filter filter)
Create a DirectoryStream that iterates over all PathAttributePair entries in the directory
dir that are
accepted by the filter. |
DirectoryStream<Path> |
Files.newDirectoryStream(Path dir)
Create a DirectoryStream that iterates over all entries in the directory
dir . |
DirectoryStream<Path> |
Files.newDirectoryStream(Path dir,
DirectoryStream.Filter filter)
Create a DirectoryStream that iterates over all entries in the directory
dir that are accepted by the filter. |
InputStream |
Files.newInputStream(Path path)
Open an existing file and return an
InputStream to read from this file. |
OutputStream |
Files.newOutputStream(Path path,
OpenOption... options)
Open an file and return an
OutputStream to write to this file. |
Path |
Files.readSymbolicLink(Path link)
Reads the target of a symbolic link (optional operation).
|
void |
Files.setPosixFilePermissions(Path path,
Set<PosixFilePermission> permissions)
Sets the POSIX permissions of a path.
|
Modifier and Type | Method and Description |
---|---|
static Path |
Utils.fromLocalPath(Files files,
String path)
Takes the String representation of a local path (for example "/bin/foo" or "C:\dir\test.txt") and converts it into a
Path . |
Path |
Sandbox.Pair.getDestination() |
static Path |
Utils.getLocalCWD(Files files)
Returns a
Path that represents the current working directory. |
static Path |
Utils.getLocalHome(Files files)
Returns a
Path that represents the home directory of the current user. |
Path |
Sandbox.getPath()
The sandbox directory.
|
Path |
Sandbox.Pair.getSource() |
static Path |
Utils.resolveWithEntryPath(Files files,
FileSystem fileSystem,
String... path)
Resolve a relative
path with the entry path of the fileSystem and return a new
Path that represents this location. |
static Path |
Utils.resolveWithRoot(Files files,
Path root,
String... path)
|
Modifier and Type | Method and Description |
---|---|
void |
Sandbox.addDownloadFile(String src,
Path dest)
Add a file to the list of files to download.
|
void |
Sandbox.addUploadFile(Path src)
Add a file to the list of files to upload.
|
void |
Sandbox.addUploadFile(Path src,
String dest)
Add a file to the list of files to upload.
|
static long |
Utils.copy(Files files,
InputStream in,
Path target,
boolean truncate)
Copies all bytes from an input stream to a file.
|
static long |
Utils.copy(Files files,
Path source,
OutputStream out)
Copies all bytes from a file to an output stream.
|
static BufferedReader |
Utils.newBufferedReader(Files files,
Path source,
Charset cs)
Opens a file for reading, returning a
BufferedReader that may be used to read text from the file in an
efficient manner. |
static BufferedWriter |
Utils.newBufferedWriter(Files files,
Path target,
Charset cs,
boolean truncate)
Opens or creates a file for writing, returning a BufferedWriter that may be used to write text to the file in an efficient
manner.
|
FileVisitResult |
FileVisitor.postVisitDirectory(Path dir,
XenonException exception,
Files files)
Invoked for a directory after entries in the directory, and all of their descendants, have been visited.
|
FileVisitResult |
FileVisitor.preVisitDirectory(Path dir,
FileAttributes attributes,
Files files)
Invoked for a directory before entries in the directory are visited.
|
static byte[] |
Utils.readAllBytes(Files files,
Path source)
Read all the bytes from a file and return them as a
byte[]<\code>. |
static List<String> |
Utils.readAllLines(Files files,
Path source,
Charset cs)
Read all lines from a file and return them in a
List . |
static String |
Utils.readToString(Files files,
Path source,
Charset cs)
Read all the bytes from a file and return them as a
String<\code> using the |
static void |
Utils.recursiveCopy(Files files,
Path source,
Path target,
CopyOption... options)
Recursively copies directories, files and symbolic links from source to target.
|
static void |
Utils.recursiveDelete(Files files,
Path path)
Recursively removes all directories, files and symbolic links in path.
|
static Path |
Utils.resolveWithRoot(Files files,
Path root,
String... path)
|
void |
Sandbox.setUploadFiles(Path... files)
Sets the list of files that will be uploaded to
files . |
FileVisitResult |
FileVisitor.visitFile(Path file,
FileAttributes attributes,
Files files)
Invoked for a file in a directory.
|
FileVisitResult |
FileVisitor.visitFileFailed(Path file,
XenonException exception,
Files files)
Invoked for a file that could not be visited.
|
static void |
Utils.walkFileTree(Files files,
Path start,
boolean followLinks,
int maxDepth,
FileVisitor visitor)
Walks a file tree.
|
static void |
Utils.walkFileTree(Files files,
Path start,
FileVisitor visitor)
Walks over a file tree.
|
static void |
Utils.write(Files files,
Path target,
byte[] bytes,
boolean truncate)
Writes bytes to a file.
|
static void |
Utils.write(Files files,
Path target,
Iterable<? extends CharSequence> lines,
Charset cs,
boolean truncate)
Write lines of text to a file.
|
Constructor and Description |
---|
Sandbox.Pair(Path source,
Path destination) |
Sandbox(Files files,
Path root,
String sandboxName)
Creates a sandbox.
|