Package-level declarations
IO API for working with files and streams.
Types
An exception class which is used when we have not enough access for some operation.
An exception class which is used when some file to create or copy to already exists.
A base exception class for file system exceptions.
This class is intended to implement different file traversal methods. It allows to iterate through all files inside a given directory.
An enumeration to describe possible walk directions. There are two of them: beginning from parents, ending with children, and beginning from children, ending with parents. Both use depth-first search.
An exception class which is used when file to copy does not exist.
Enum that can be used to specify behaviour of the copyRecursively()
function in exceptional conditions.
Properties
Returns the default buffer size when working with buffered streams.
Returns path of this File using the invariant separator '/' to separate the names in the name sequence.
Functions
Appends an array of bytes to the content of this file.
Creates a buffered input stream wrapping this stream.
Creates a buffered output stream wrapping this stream.
Returns a buffered reader wrapping this Reader, or this Reader itself if it is already buffered.
Returns a buffered writer wrapping this Writer, or this Writer itself if it is already buffered.
Creates a buffered reader on this input stream using UTF-8 or the specified charset.
Returns a new BufferedReader for reading the content of this file.
Creates a buffered writer on this output stream using UTF-8 or the specified charset.
Returns a new BufferedWriter for writing the content of this file.
Creates a new byte input stream for the string.
Copies this file with all its children to the specified destination target path. If some directories on the way to the destination are missing, then they will be created.
Copies this stream to the given output stream, returning the number of bytes copied
Copies this reader to the given out writer, returning the number of characters copied.
Copies this file to the given target file.
Delete this file with all its children. Note that if this operation fails then partial deletion may have taken place.
Determines whether this file path ends with the path of other file.
Determines whether this file belongs to the same root as other and ends with all components of other in the same order. So if other has N components, last N components of this
must be the same as in other. For relative other, this
can belong to any root.
Reads file by byte blocks and calls action for each block read. Block has default size which is implementation-dependent. This functions passes the byte array and amount of bytes in the array to the action function.
Reads file by byte blocks and calls action for each block read. This functions passes the byte array and amount of bytes in the array to the action function.
Constructs a new FileInputStream of this file and returns it as a result.
Creates an input stream for reading data from this byte array.
Creates an input stream for reading data from the specified portion of this byte array.
Returns an Iterator of bytes read from this input stream.
Returns a sequence of corresponding file lines.
Constructs a new FileOutputStream of this file and returns it as a result.
Prints the given message to the standard output stream.
Prints the line separator to the standard output stream.
Prints the given message and the line separator to the standard output stream.
Returns a new PrintWriter for writing the content of this file.
Gets the entire content of this file as a byte array.
Reads the entire content of the URL as byte array.
Reads this stream completely into a byte array.
Creates a new reader for the string.
Returns a new FileReader for reading the content of this file.
Creates a reader on this input stream using UTF-8 or the specified charset.
Adds relative file to this, considering this as a directory. If relative has a root, relative is returned back. For instance, File("/foo/bar").resolve(File("gav"))
is File("/foo/bar/gav")
. This function is complementary with relativeTo, so f.resolve(g.relativeTo(f)) == g
should be always true
except for different roots case.
Adds relative name to this, considering this as a directory. If relative has a root, relative is returned back. For instance, File("/foo/bar").resolve("gav")
is File("/foo/bar/gav")
.
Adds relative file to this parent directory. If relative has a root or this has no parent directory, relative is returned back. For instance, File("/foo/bar").resolveSibling(File("gav"))
is File("/foo/gav")
.
Adds relative name to this parent directory. If relative has a root or this has no parent directory, relative is returned back. For instance, File("/foo/bar").resolveSibling("gav")
is File("/foo/gav")
.
Calls the block callback giving it a sequence of all the lines in this file and closes the reader once the processing is complete.
Gets a sequence for visiting this directory and all its content.
Gets a sequence for visiting this directory and all its content in bottom-up order. Depth-first search is used and directories are visited after all their files.
Gets a sequence for visiting this directory and all its content in top-down order. Depth-first search is used and directories are visited before all their files.
Sets the content of this file as an array of bytes. If this file already exists, it becomes overwritten.
Returns a new FileWriter for writing the content of this file.
Creates a writer on this output stream using UTF-8 or the specified charset.