Constructs a new finder that selects all paths with a name that matches filter
and are
immediate children of paths selected by this finder.
Constructs a new finder that selects all paths with a name that matches filter
and are
immediate children of paths selected by this finder.
Constructs a new finder that selects all paths with a name that matches filter
and are
descendants of paths selected by this finder.
Constructs a new finder that selects all paths with a name that matches filter
and are
descendants of paths selected by this finder.
The union of the paths found by this PathSet
with the paths found by 'paths'.
The union of the paths found by this PathSet
with the paths found by 'paths'.
Note that if the same element is added twice it will be present twice in the PathFinder
(in most implementations). Consider: (Path("a") +++ Path("a")).iterator. the iterator
will return Path("a") twice.
Excludes all paths from excludes
from the paths selected by this PathSet
.
Excludes all paths from excludes
from the paths selected by this PathSet
.
If child is relative, creates a new Path based on the current path with the child appended.
If child is relative, creates a new Path based on the current path with the child appended. If child is absolute the child is returned
<
@note child is a single child if it contains a path separator it will NOT be considered a separator character
Examples include:
path / "child" / "grandchild"
path / ".." / "sibling"
Illegal examples include;
path / "child/grandchild"
path / "../sibling"
In these cases an exception will be thrownA new path with the specified path appended
#\(String)
Alias for /(child.
Alias for /(child.name)
A new path with the specified path appended
#/(String)
Add several children to this path.
Add several children to this path. The sep character will be used to split the path string, A path will be created from the resulting sequence and finally all children will be added to this path.
Examples:
path / ("a,c,d,e", ',') // results in path / a / c / d / e path / ("/a/b/c/d/", '/') // results in path / a / b / c / d path / ("//../a","/") // results in path / .. / a path / ("/a",',') // results in an exception if / == Path.separator path / ("//",'/') // returns same Path
Alias for /(Path)
Alias for /(Path)
#/(Path)
Alias for /(String)
Alias for /(String)
/(String)
Reads the access modes from the file and returns the Set This does not lock the file so the modes could be out of date even by the time the method returns if used in a heavily parallel environment
Reads the access modes from the file and returns the Set This does not lock the file so the modes could be out of date even by the time the method returns if used in a heavily parallel environment
the access modes set on the file
Sets the standard access modes on the underlying path.
Sets the standard access modes on the underlying path. If the underlying object does not exist it will throw an exception. If the underlying system does not support support the mode the mode will be ignored
the modes to set on the file in (if possible) a single atomic update
Short cut for setting the standard access modes on the underlying path.
Short cut for setting the standard access modes on the underlying path. If the underlying object does not exist it will throw an exception. If the underlying system does not support support the mode the mode will be ignored
string representation of the modes. The standard options include r - read, w - write, e - execute. The options are filesystem dependent
Append a string to the end of the Seekable object.
Append a string to the end of the Seekable object.
the data to write
the codec of the string to be written. The string will be converted to the encoding of scalax.io.Codec
Append bytes to the end of a file
Append bytes to the end of a file
Important: The use of an Array is highly recommended because normally arrays can be more efficiently written using the underlying APIs
The data to write. This can be any type that has a scalax.io.OutputConverter associated with it. There are predefined $outputConverters for several types. See the scalax.io.OutputConverter object for the predefined types and for objects to simplify implementing custom scalax.io.OutputConverter
$converterParam
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE
outputStream.write(1)
1 is written as a single byte.
Append several strings to the end of the Seekable object.
Append several strings to the end of the Seekable object.
The strings to write
A string to add between each string. It is not added to the before the first string or after the last.
The codec of the strings to be written. The strings will be converted to the encoding of scalax.io.Codec
Read the input as blocks of bytes.
Read the input as blocks of bytes. This method should be avoided unless the maximum performance is absolutely required because bytes provides very good performance and is a better API for most applications.
However since it better reflects how data is read with most input sources (like InputStreams and ReadableByteChannels); blocks is slightly more performance than bytes and therefore can be used when performance is the most important consideration.
block size can optionally be specified but the default is normally acceptable.
This method aspires to be the fastest way to read a stream of known length into memory.
This method aspires to be the fastest way to read a stream of known length into memory.
Obtains a Traversable for conveniently processing the resource as bytes.
Obtains a Traversable for conveniently processing the file as Ints.
The characters in the object.
The characters in the object.
If the codec is not the same as the source codec (the codec of the underlying data) then the characters will converted to the desired codec.
The codec representing the desired encoding of the characters
an traversable of all the characters
Check if the referenced file both exists and be accessed with the requested modes
Check if the referenced file both exists and be accessed with the requested modes
the modes to check for on the file. If empty then only existance is checked
true if all modes are available on the file
Check modes using the rwx characters.
Check modes using the rwx characters. The string can be from 1-3 characters long and can be r w x in any order. Spaces are ignored
An iterable over the contents of the directory.
An iterable over the contents of the directory. This is simply walkTree with depth=1.
The filter parameter restricts what paths are available through the PathSet. This is different from using the filter, filterFold or filterEach methods in PathSet because PathMatchers can be used by the underlying filesystem natively and can potentially provide dramatically improved performance for very large directories.
A filter that restricts what paths are available in the PathSet If the filter is a PathMatcher and the underlying filesystem supports the PatchMatcher implementation then the maximum performance will be achieved. All Paths that are passed to matcher is relative to this Path Default is PathMatcher.All
A managed resource managing a PathSet.
FileSystem#matcher(String,String)
Path.Matching
Path#walkTree
Compares this path to the other lexigraphically.
Compares this path to the other lexigraphically.
Get the Resource context that configures how the underlying resource is accessed
Copy all data from this Input object to the Output object as efficiently as possible.
Copy the underlying object if it exists to the target location.
Copy the underlying object if it exists to the target location. If the underlying object is a directory it is not copied recursively.
the target path to copy the filesystem object to.
if true then copy the File attributes of the object as well as the data. True by default
if true then replace any existing target object unless it is a non-empty directory in which case an IOException is thrown. False by default
The depth of the copy if the path is a Directory. A depth of 0 means only the current Path is copied A depth of 1 means all children are copied as well, etc... default is entire tree
the path to the new copy
if the copy could not be satisfied because the target could not be written to or if this path cannot be copied
Create the directory referenced by this path.
Create the directory referenced by this path.
If failIfExists then IOException is thrown if the file already exists. In the next Java 7 only version it will throw FileAlreadyExistsException
An exception is always thrown if the file is a directory and that directory contains children
An exception will also be thrown if the parent directory does not have write permission
If true then the containing directories will be created if they do not exist Default is true
If true and an object exists then an exception will be thrown If false then the object will be deleted if possible If not possible to delete the object or it is a non-empty directory an exception will be thrown Default is true
The access modes that to set on the file Default is Read,Write
Filesystem specific attributes to fromString to the file Ignored unless on Java 7+ JVM
if file or directory already exists. In the next Java 7 only version it will throw FileAlreadyExistsException If the process does not have write permission to the parent directory If parent directory does not exist
Create the file referenced by this path.
Create the file referenced by this path.
If failIfExists then IOException is thrown if the file already exists. In the next Java 7 only version it will throw FileAlreadyExistsException
An exception is always thrown if the file is a directory and that directory contains children
An Exception will also be thrown if the parent directory does not have write permission
If true then the containing directories will be created if they do not exist Default is true
If true and an object exists then an exception will be thrown If false then the object will be deleted if possible If not possible to delete the object or it is a non-empty directory an exception will be thrown Default is true
The access modes that to set on the file Default is Read,Write
Filesystem specific attributes to fromString to the file Ignored unless on Java 7+ JVM
If file or directory already exists. In the next Java 7 only version it will throw FileAlreadyExistsException If the process does not have write permission to the parent directory If parent directory does not exist
Deletes the file or throws an IOException on failure
Deletes the file or throws an IOException on failure
if the file is write protected force will override the write protection and delete the file. If not force then an IOException will be thrown indicating failure of deletion. Default is false
this
if the file could not be deleted
Delete the filesystem object if the file exists.
Delete the filesystem object if the file exists.
If the file exists and is a non-empty Directory or there is some other reason the operation cannot be performed an IOException will be thrown.
If the file does not exist it will return false
if the file is write protected force will override the write protection and delete the file. If not force then an IOException will be thrown indicating failure of deletion. Default is false
if the file cannot be written or if there is some other reason the file cannot be deleted. For example if the file is a non-empty directory
Deletes the directory recursively.
Deletes the directory recursively.
This method does not detect circular directory graphs and does not promise to perform the delete in an atomic operation
Use with caution!
if the file is write protected force will override the write protection and delete the file. If not force then an IOException will be thrown indicating failure of deletion. Default is false
If false then method will throw an exception when encountering a file that cannot be deleted. Otherwise it will continue to delete all the files that can be deleted. Note: this method is not transactional, all files visited before failure are deleted.
Tuple with (The number of files deleted, The number of files remaining)
when continueOnFailure is false and a file cannot be deleted
An iterable that traverses all the elements in the directory tree down to the specified depth
An iterable that traverses all the elements in the directory tree down to the specified depth
The filter parameter is a function because the PathSet can return files from many directories. The function provides the mechanism for declaring which PathMatcher to use at each level. The two parameters are original path and the path to be visited relative to the original path. By default the function always returns None.
If the depth parameter is non-negative then that restricts the depth that will be traversed. The value 0 will not return any
elements, depth = 1 is essentially the path#directoryStream(Option,Boolean)
method and values < 0 will return all elements
at any depth.
The traversal order is pre-order.
No exceptions will be thrown by this method if it is called and the Path is a File or does not exist. Instead the PathSet
will throw a NotDirectoryException when a method is called and the underlying object is not a Directory.
A filter that restricts what paths are available in the PathSet If the filter is a PathMatcher and the underlying filesystem supports the PatchMatcher implementation then the maximum performance will be achieved. All Paths that are passed to matcher is relative to this Path Default is PathMatcher.All
How deep down the tree to traverse 1 is just visit the objects in the directory negative values will visit entire tree Default is -1
A managed resource managing a PathSet.
FileSystem#matcher(String,String)
Path.Matching
Path#directoryStream(Option,Boolean)
If possible efficiently copy data from input.
NOT PUBLIC API: Create a directory for the current path without considering if the parents has been previously created.
NOT PUBLIC API: Create a directory for the current path without considering if the parents has been previously created. This method should fail if the parent does not exist
NOT PUBLIC API: Create a file for the current path without considering if the parents has been previously created.
NOT PUBLIC API: Create a file for the current path without considering if the parents has been previously created. This method should fail if the parent does not exist
NOT PUBLIC API: Create all parent directories of the current Path
NOT PUBLIC API: Create all parent directories of the current Path
True if this path ends with the other path
True if this path ends with the other path
True if this path ends with the other path
True if the path exists in the file system
True if the path exists in the file system
true if the path exists in the file system
java.file.File#exists
The extension of the name of the path, if it exists.
The extension of the name of the path, if it exists. if name ends with an extension (e.g. "foo.jpg") returns the extension ("jpg")
the extension of the path
Return a java.
Return a java.io.File if possible
Inserts data at a position in the Seekable.
Inserts data at a position in the Seekable. The actual position in the Seekable where the data is inserted depends on the type of data being written. For example if Longs are being written then position calculated as position * 8
Important: The use of an Array is highly recommended because normally arrays can be more efficiently written using the underlying APIs
The position where the data is inserted into the Seekable. The actual position in the Seekable where the data is inserted depends on the type of data being written. For example if Longs are being written then position calculated as position * 8
The data to write. This can be any type that has a scalax.io.OutputConverter associated with it. There are predefined $outputConverters for several types. See the scalax.io.OutputConverter object for the predefined types and for objects to simplify implementing custom scalax.io.OutputConverter
$converterParam
Inserts a string at a position in the Seekable.
Inserts a string at a position in the Seekable. This is a potentially inefficient because of the need to count characters. If the codec is not a fixed sized codec (for example UTF8) each character must be converted in the file up to the point of insertion.
The position in the file to perform the insert. A position of 2 will insert the character after the second character (not byte).
The string that will be inserted into the Seekable
The codec to use for determining the location for inserting the string and for encoding the string as bytes
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE
outputStream.write(1)
1 is written as a single byte.
True is the file is absolute.
True is the file is absolute. IE is rooted at a filesystem root
true if file is absolute.
java.file.File#isAbsolute
True if the path exists and is a directory
True if the path exists and is a directory
true if the path exists and is a directory
java.file.File#isDirectory
True if the path exists and is a file
True if the path exists and is a file
true if the path exists and is a file
java.file.File#isFile
True if this path has been modified more recently than other.
True if this path has been modified more recently than other. If this file does not exist it is not fresh than other
True if this path has been modified more recently than other.
True if the file is a hidden file for the current filesystem
True if the file is a hidden file for the current filesystem
True if the file is a hidden file for the current filesystem
java.file.File#isHidden()
True if this path and the other path reference the same file.
True if this path and the other path reference the same file.
This means the two paths may have different segments and perhaps even have symlinks in the path but if they reference the same file then this will return true. Use equals to test if the paths are the same
True if this path and the other path reference the same file.
True if the file is a symlink.
True if the file is a symlink.
This method is generally correct but depending the filesystem there is a possibility of getting the the incorrect result since the canonical and absolute paths are compared and no native code is used. Future versions will be guaranteed to work correctly but this version cannot be because of limitations of the VM.
True if the file is a symlink.
The time of the last modification of the file
The time of the last modification of the file
the time modified or -1 if not applicable for fileSystem
java.file.File#getLastModified()
Set the last time modified of the file
Set the last time modified of the file
the new time
java.file.File#setLastModified(Long)
Obtain an non-strict traversable for iterating through the lines in the object
Obtain an non-strict traversable for iterating through the lines in the object
If the codec is not the same as the source codec (the codec of the underlying data) then the characters will converted to the desired codec.
The strategy for determining the end of line Default is to auto-detect the EOL
if true then the line will end with the line terminator Default is false
The codec representing the desired encoding of the characters
a non-strict traversable for iterating through all the lines
Create a matcher from this path's filesystem
Create a matcher from this path's filesystem
FileSystem # matcher ( String, String )
Called to move the current directory to another location on the same filesystem
Called to move the current directory to another location on the same filesystem
Called to move the current file to another location on the same filesystem
Called to move the current file to another location on the same filesystem
Move the underlying object if it exists to the target location.
Move the underlying object if it exists to the target location.
If copying of the file is required this will happen, as long as atomicMove = false. If atomicMove = true and the move requires copy then deletion an exception will be thrown. This is filesystem dependent
the target path to move the filesystem object to.
if true then replace any existing target object unless it is a non-empty directory in which case an IOException is thrown. False by default
it will guarantee atomicity of the move False by default
true the path to the moved object
if the move could not be satisfied because the target could not be written to or if this path cannot be moved
The name of the file.
The name of the file. This includes the extension of the file
the name of the file
False if the path does not exist in the file system
False if the path does not exist in the file system
false if the path does not exist in the file system
Returns the related Path that starts at a root of the file system and is the direct path with all relative segments are resolved.
Returns the related Path that starts at a root of the file system and is the direct path with all relative segments are resolved.
For example /home/user/../another is not a valid normalized path.
java.file.File#toCanonical
#toAbsolute
Execute the function 'f' passing an Output instance that performs all operations on a single opened connection to the underlying resource.
Execute the function 'f' passing an Output instance that performs all operations on a single opened connection to the underlying resource. Typically each call to one of the Output's methods results in a new connection. For example if the underlying OutputStream truncates the file each time the connection is made then calling write two times will result in the contents of the second write overwriting the second write.
Even if the underlying resource is an appending, using open will be more efficient since the connection only needs to be made a single time.
the result of the function
The parent path segment if it is possible (for example a root will not have a parent)
The parent path segment if it is possible (for example a root will not have a parent)
the parent path segment if it possible
parents
The path segments of the path excluding the current path segment.
The path segments of the path excluding the current path segment. The first segment is the first segment in the path.
The path segments of the path excluding the current path segment
segments
Update a portion of the file content at the declared location.
Update a portion of the file content at the declared location. This is the most flexible of the random access methods but is also (probably) the trickiest to fully understand. That said it behaves (almost) identical to a scala.collection.Seq.patch method, so if you understand that you should not have difficulty understanding this method.
Important: The use of an Array is highly recommended because normally arrays can be more efficiently written using the underlying APIs
To append data the position must >= size
If the position is within the file but the
position + bytes.length
is beyond the end of the file the file will be enlarged so
that the entire string can fit in the file
The write begins at the position indicated. So if position = 0 then the write will begin at the first byte of the file.
The start position of the update starting at 0. The position must be within the file or == size (for appending)
The data to write. This can be any type that has a scalax.io.OutputConverter associated with it. There are predefined $outputConverters for several types. See the scalax.io.OutputConverter object for the predefined types and for objects to simplify implementing custom scalax.io.OutputConverter
The strategy that dictates how many characters/bytes/units are overwritten $converterParam
Update a portion of the file content at the declared location.
Update a portion of the file content at the declared location. This is the most flexible of the random access methods but is also (probably) the trickiest to fully understand. That said it behaves (almost) identical to a scala.collection.Seq.patch method, so if you understand that you should not have difficulty understanding this method.
If the position is beyond the end of the file a BufferUnderflow Exception will be thrown
If the position is within the file but the
position + string.getBytes(codec).length
is beyond the end of the file the file will be enlarged so
that the entire string can fit in the file
The write begins at the position indicated. So if position = 0 then the write will begin at the first byte of the file.
The start position of the update starting at 0. The position is the position'th character in the file using the codec for decoding the file The position must be within the file.
The string to write to the file starting at position.
The strategy that dictates how many characters/bytes/units are overwritten
The codec to use for decoding the underlying data into characters
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE
outputStream.write(1)
1 is written as a single byte.
The path of the file.
The path of the file. It may or may not be relative
the path of the file
Make the current path relative to the other path.
Make the current path relative to the other path. If the two paths are on different drives then the other path is returned. If the two paths have different roots the other path is returned. If the two paths reference the same path then the other path is returned
relative path from the current path to the other path
Constructs a path from other using the same file system as this
path and resolves the this and other in the same manner as
Path#resolve(Path)
Constructs a path from other using the same file system as this
path and resolves the this and other in the same manner as
Path#resolve(Path)
Examples:
path resolve ("a/b/c",'/') // result is Path / a / b / c path resolve ("//..//b//",'/') // result is Path / .. / b
the path segments that make up the path
a path resolved as a child of this
Constructs a path from other using the same file system as this
path and resolves the this and other in the same manner as
Path#resolve(Path)
Constructs a path from other using the same file system as this
path and resolves the this and other in the same manner as
Path#resolve(Path)
Examples:
path resolve ("a/b/c",'/') // result is Path / a / b / c path resolve ("//..//b//",'/') // result is Path / .. / b
the string representation of the path with segment separators as indicated by separator
the separator character used in other
a path resolved as a child of this
Resolve this path with other.
Resolve this path with other. In the simplest case that means appending other to this.
Does the same thing as the / method
another path to append to this path
the constructed/resolved path
The root of the file system of the path if it can be determined.
The root of the file system of the path if it can be determined.
the root of the file system
Runs several operations as efficiently as possible.
Runs several operations as efficiently as possible. If the filesystem permits random access then the same channel will be used to perform all operations.
Note: only the direct file operations (bytes,lines,write,patch etc...) can be used and expected to use the same resource. The resource methods all created new streams.
Note: not all file systems support this, if not then at worst the performance is the same as if they where performed outside an open block
The options that define how the file is opened for the duration of the operation Default is Write/Create/Truncate
The context for controlling buffer sizes error handling and other low level configuration defaults to filesystem Resource context
The path segment separator string for the filesystem
The path segment separator string for the filesystem
FileSystem#separator
Resolves other against this path's parent in the same manner as sibling(Path)
Resolves other against this path's parent in the same manner as sibling(Path)
the path from parent to the sibling.
a path resolved as a child of parent or other if there is no parent
Resolves other against this path's parent in the same manner as sibling(Path)
Resolves other against this path's parent in the same manner as sibling(Path)
the path from parent to the sibling.
the separator character that is used in other
a path resolved as a child of parent or other if there is no parent
Resolves other against this path's parent in the same manner as in resolve(Path).
Resolves other against this path's parent in the same manner as in resolve(Path).
If parent does not exist fileSystem.fromSeq(other.segments) will be returned. Otherwise parent.resolve(other) will be returned
the path from parent to the sibling.
a path resolved as a child of parent or None if parent is None
The name of the file excluding of the file
The name of the file excluding of the file
name of the file excluding of the file
The size of the file/directory in bytes
The size of the file/directory in bytes
The size of the file/directory in bytes
java.file.File#length()
True if this path starts with the other path
True if this path starts with the other path
True if this path starts with the other path
Loads all the characters into memory.
Loads all the characters into memory. There is no protection against loading very large files/amounts of data.
The codec representing the desired encoding of the characters
Create a temporary file to use for performing certain operations.
Modifies the Path so that it is absolute from a root of the file system.
Modifies the Path so that it is absolute from a root of the file system. However it is not necessarily canonical. For example /home/user/../another is a valid absolute path.
normalize
Open a seekableByteChannelResource to use for creating other long traversables like chars or bytes as its.
Open a seekableByteChannelResource to use for creating other long traversables like chars or bytes as its.
This method may throw an exception if the file does not exist
Main feature is it sets position to 0 each call so the resource will always read from 0
The true/real representation of the current path.
The true/real representation of the current path.
The full and true path of this path will be resolved, links will be handled according to the link options . and .. etc... will be resolved and if this path is relative it will be made absolute.
If no linkOptions are supplied this method will follow links
How to handle link options
the real path
in Java 6 linkOptions are ignored because only Java.io.File apis are used but in Java 7 linkOptions are correctly handled
Creates a URI from the path.
Creates a URI from the path.
java.file.File#toURI
Creates a URL from the path.
Creates a URL from the path. This does have the bug present in java.file.File#toURL
and can be used directly.
java.file.File#toURI
Truncate/Chop the Seekable to the number of bytes declared by the position param
Truncate/Chop the Seekable to the number of bytes declared by the position param
Writes a string.
Writes a string.
the data to write
the codec of the string to be written. The string will
be converted to the encoding of sourceCodec
Default is sourceCodec
Write data to the underlying object.
Write data to the underlying object. Each time write is called the resource is reopened, in the case of a file this means that the file will be opened and truncated. The
In the case of writing ints and bytes it is often recommended to write arrays of data since normally the underlying object can write arrays of bytes or integers most efficiently.
Since Characters require a codec to write to an OutputStream characters cannot be written with this method unless a OutputWriterFunction.CharFunction object is provided as the writer.
The data to write to underlying object. Any data that has a resolvable scalax.io.OutputConverter can be written. See the scalax.io.OutputConverter object for the defined scalax.io.OutputConverter implementations and classes to assist implementing more.
The strategy used to write the data to the underlying object. Many standard data-types are implicitly resolved and do not need to be supplied
#writeChars for more on writing characters
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.
Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE
outputStream.write(1)
1 is written as a single byte.
Write several strings.
Write several strings.
The data to write
A string to add between each string. It is not added to the before the first string or after the last.
The codec of the strings to be written. The strings will
be converted to the encoding of sourceCodec
Not Part of API
A file reference that locates a file using a system independent path. The file is not required to exist.
1.0