IO
A collection of File, URL, and I/O utility methods.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IO.type
Members list
Value members
Concrete methods
Appends content
to the existing contents of file
using charset
or UTF-8 if charset
is not explicitly specified. If file
does not exist, it is created, as are any parent directories.
Appends content
to the existing contents of file
using charset
or UTF-8 if charset
is not explicitly specified. If file
does not exist, it is created, as are any parent directories.
Attributes
Appends bytes
to the existing contents of file
. If file
does not exist, it is created, as are any parent directories.
Appends bytes
to the existing contents of file
. If file
does not exist, it is created, as are any parent directories.
Attributes
Converts the given URL to a File. If the URL is for an entry in a jar, the File for the jar is returned.
Converts the given URL to a File. If the URL is for an entry in a jar, the File for the jar is returned.
Attributes
An alias for setGroup. Updates the group owner of the file. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
An alias for setGroup. Updates the group owner of the file. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
Attributes
An alias for setPermissions
. Updates permission of this file. This operation requires underlying filesystem to support IO.isPosix
.
An alias for setPermissions
. Updates permission of this file. This operation requires underlying filesystem to support IO.isPosix
.
Value parameters
- permissions
-
Must be 9 character POSIX permission representation e.g. "rwxr-x---"
Attributes
An alias for setOwner
. Updates the file owner. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
An alias for setOwner
. Updates the file owner. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
Attributes
Returns the URL to the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, a module will return a jrt URL such as jrt:/java.base
.
Returns the URL to the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, a module will return a jrt URL such as jrt:/java.base
.
Attributes
Returns the URL to the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, a module will return a jrt path.
Returns the URL to the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, a module will return a jrt path.
Attributes
Returns the directory, Java module, or the JAR containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
, so it will return None
.
Returns the directory, Java module, or the JAR containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
, so it will return None
.
Attributes
Returns the directory, Java module, or the JAR containing the class file for type T
(as determined by an implicit Manifest). If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
, so it will return None
.
Returns the directory, Java module, or the JAR containing the class file for type T
(as determined by an implicit Manifest). If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
, so it will return None
.
Attributes
Returns the NIO Path to the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined, an error is generated. Note that for JDK 11 onwards, a module will return a jrt path.
Returns the NIO Path to the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined, an error is generated. Note that for JDK 11 onwards, a module will return a jrt path.
Attributes
Returns a NIO Path to the directory, Java module, or the JAR file for type A
(as determined by an implicit Manifest). If the location cannot be determined, an error is generated. Note that for JDK 11 onwards, a module will return a jrt path.
Returns a NIO Path to the directory, Java module, or the JAR file for type A
(as determined by an implicit Manifest). If the location cannot be determined, an error is generated. Note that for JDK 11 onwards, a module will return a jrt path.
Attributes
Returns a URL for the classfile containing the given class file for type T
(as determined by an implicit Manifest). If the location cannot be determined, an error is generated.
Returns a URL for the classfile containing the given class file for type T
(as determined by an implicit Manifest). If the location cannot be determined, an error is generated.
Attributes
Returns a URL for the classfile containing the given class If the location cannot be determined, an error is generated.
Returns a URL for the classfile containing the given class If the location cannot be determined, an error is generated.
Attributes
For each pair in sources
, copies the contents of the first File (the source) to the location of the second File (the target).
For each pair in sources
, copies the contents of the first File (the source) to the location of the second File (the target).
See sbt.io.CopyOptions for docs on the options available.
Any parent directories that do not exist are created. The set of all target files is returned, whether or not they were updated by this method.
Attributes
Copies the contents of each file in the source
directory to the corresponding file in the target
directory.
Copies the contents of each file in the source
directory to the corresponding file in the target
directory.
See sbt.io.CopyOptions for docs on the options available.
Files in target
without a corresponding file in source
are left unmodified in any case. Any parent directories that do not exist are created.
Attributes
Transfers the executable property of sourceFile
to targetFile
.
Transfers the executable property of sourceFile
to targetFile
.
Attributes
Copies the contents of sourceFile
to the location of targetFile
, overwriting any existing content.
Copies the contents of sourceFile
to the location of targetFile
, overwriting any existing content.
See sbt.io.CopyOptions for docs on the options available.
Attributes
Transfers the last modified time of sourceFile
to targetFile
.
Transfers the last modified time of sourceFile
to targetFile
.
Note: this method has a special semantics if files are missing. In particular, if the source file is missing, it will silently set the target modification time to 1st January 1970, which corresponds to the Unix epoch.
The method returns true if the target file modification time was successfully changed, false otherwise.
The deprecated related method copyModifiedTime() has a somewhat different semantics, please refer to its documentation for additional details.
Attributes
- See also
-
copyModifiedTime
Creates directories dirs
and all parent directories. It tries to work around a race condition in File.mkdirs()
by retrying up to a limit.
Creates directories dirs
and all parent directories. It tries to work around a race condition in File.mkdirs()
by retrying up to a limit.
Attributes
Creates directory dir
and all parent directories. It tries to work around a race condition in File.mkdirs()
by retrying up to a limit.
Creates directory dir
and all parent directories. It tries to work around a race condition in File.mkdirs()
by retrying up to a limit.
Attributes
Creates a directory in the default temporary directory with a name generated from a random integer.
Creates a directory in the default temporary directory with a name generated from a random integer.
Attributes
Creates a directory in baseDirectory
with a name generated from a random integer
Creates a directory in baseDirectory
with a name generated from a random integer
Attributes
The default Charset used when not specified: UTF-8.
The default Charset used when not specified: UTF-8.
Attributes
Deletes each file or directory (recursively) in files
.
Deletes each file or directory (recursively) in files
.
Attributes
Deletes file
, recursively if it is a directory. Note that this method may silently fail to delete the file (or directory) if any errors occur.
Deletes file
, recursively if it is a directory. Note that this method may silently fail to delete the file (or directory) if any errors occur.
Attributes
Deletes each file or directory in files
recursively. Any empty parent directories are deleted, recursively.
Deletes each file or directory in files
recursively. Any empty parent directories are deleted, recursively.
Attributes
Deletes all empty directories in the set. Any non-empty directories are ignored.
Deletes all empty directories in the set. Any non-empty directories are ignored.
Attributes
Converts an absolute File to a URI. The File is converted to a URI (toURI), normalized (normalize), encoded (toASCIIString), and a forward slash ('/') is appended to the path component if it does not already end with a slash.
Converts an absolute File to a URI. The File is converted to a URI (toURI), normalized (normalize), encoded (toASCIIString), and a forward slash ('/') is appended to the path component if it does not already end with a slash.
Attributes
Converts an absolute File to a URI. The File is converted to a URI (toURI), normalized (normalize), encoded (toASCIIString), and a forward slash ('/') is appended to the path component if it does not already end with a slash.
Converts an absolute File to a URI. The File is converted to a URI (toURI), normalized (normalize), encoded (toASCIIString), and a forward slash ('/') is appended to the path component if it does not already end with a slash.
Attributes
Applies f
to each line read from in
and the accumulated value of type T
, with initial value init
. This method does not close in
.
Applies f
to each line read from in
and the accumulated value of type T
, with initial value init
. This method does not close in
.
Attributes
Applies f
to each line read from in
. This method does not close in
.
Applies f
to each line read from in
. This method does not close in
.
Attributes
Return the last modification timestamp of the specified file, in milliseconds since the Unix epoch (January 1, 1970 UTC).
Return the last modification timestamp of the specified file, in milliseconds since the Unix epoch (January 1, 1970 UTC).
If the specified file does not exist, this method will return 0L.
The deprecated method getModifiedTime() has similar semantics, but will throw an exception if the file does not exist. Please refer to its documentation for additional details.
Attributes
- See also
-
getModifiedTime
Gunzips the file 'in' and writes it to 'out'. 'in' cannot be the same file as 'out'.
Gunzips the file 'in' and writes it to 'out'. 'in' cannot be the same file as 'out'.
Attributes
Gunzips the InputStream 'input' and writes it to 'output'. Neither stream is closed.
Gunzips the InputStream 'input' and writes it to 'output'. Neither stream is closed.
Attributes
Gzips the file 'in' and writes it to 'out'. 'in' cannot be the same file as 'out'.
Gzips the file 'in' and writes it to 'out'. 'in' cannot be the same file as 'out'.
Attributes
Gzips the InputStream 'in' and writes it to 'output'. Neither stream is closed.
Gzips the InputStream 'in' and writes it to 'output'. Neither stream is closed.
Attributes
Applies f
to a buffered gzip InputStream
for file
. The streams involved are opened before calling f
and closed after it returns. The result is the result of f
.
Applies f
to a buffered gzip InputStream
for file
. The streams involved are opened before calling f
and closed after it returns. The result is the result of f
.
Attributes
Applies f
to a buffered gzip OutputStream
for file
. The streams involved are opened before calling f
and closed after it returns. The result is the result of f
.
Applies f
to a buffered gzip OutputStream
for file
. The streams involved are opened before calling f
and closed after it returns. The result is the result of f
.
Attributes
Returns true
if the filesystem supports POSIX file attribute view.
Returns true
if the filesystem supports POSIX file attribute view.
Attributes
Creates a jar file.
Creates a jar file.
Value parameters
- manifest
-
The manifest for the jar.
- outputJar
-
The file to write the jar to.
- sources
-
The files to include in the jar file paired with the entry name in the jar. Only the pairs explicitly listed are included.
- time
-
static timestamp to use for all entries, if any, in milliseconds since Epoch
Attributes
Returns the children of directory dir
that match filter
in a non-null array.
Returns the children of directory dir
that match filter
in a non-null array.
Attributes
Returns the children of directory dir
that match filter
in a non-null array.
Returns the children of directory dir
that match filter
in a non-null array.
Attributes
Returns the children of directory dir
in a non-null array.
Returns the children of directory dir
in a non-null array.
Attributes
Reads the properties in from
into properties
. If from
does not exist, properties
is left unchanged.
Reads the properties in from
into properties
. If from
does not exist, properties
is left unchanged.
Attributes
For each pair in files
, moves the contents of the first File to the location of the second. See sbt.io.IO$.move(java.io.File,java.io.File):Unit
for the behavior of the individual move operations.
For each pair in files
, moves the contents of the first File to the location of the second. See sbt.io.IO$.move(java.io.File,java.io.File):Unit
for the behavior of the individual move operations.
Attributes
Moves the contents of a
to the location specified by b
. This method deletes any content already at b
and creates any parent directories of b
if they do not exist. It will first try File.renameTo
and if that fails, resort to copying and then deleting the original file. In either case, the original File will not exist on successful completion of this method.
Moves the contents of a
to the location specified by b
. This method deletes any content already at b
and creates any parent directories of b
if they do not exist. It will first try File.renameTo
and if that fails, resort to copying and then deleting the original file. In either case, the original File will not exist on successful completion of this method.
Attributes
Parses a classpath String into File entries according to the current platform's path separator.
Parses a classpath String into File entries according to the current platform's path separator.
Attributes
Splits a String around the platform's path separator characters.
Splits a String around the platform's path separator characters.
Attributes
Reads the full contents of file
into a String using charset
or UTF-8 if charset
is not explicitly specified.
Reads the full contents of file
into a String using charset
or UTF-8 if charset
is not explicitly specified.
Attributes
Reads the full contents of in
into a byte array.
Reads the full contents of in
into a byte array.
Attributes
Reads the full contents of in
into a byte array. This method does not close in
.
Reads the full contents of in
into a byte array. This method does not close in
.
Attributes
Reads all of the lines in file
using the provided charset
or UTF-8 if charset
is not explicitly specified.
Reads all of the lines in file
using the provided charset
or UTF-8 if charset
is not explicitly specified.
Attributes
Reads all of the lines from in
. This method does not close in
.
Reads all of the lines from in
. This method does not close in
.
Attributes
Reads all of the lines from url
using the provided charset
or UTF-8 if charset
is not explicitly specified.
Reads all of the lines from url
using the provided charset
or UTF-8 if charset
is not explicitly specified.
Attributes
Reads the full contents of in
into a byte array. This method does not close in
.
Reads the full contents of in
into a byte array. This method does not close in
.
Attributes
Returns the path for file
relative to directory base
or None if base
is not a parent of file
. If file
or base
are not absolute, they are first resolved against the current working directory.
Returns the path for file
relative to directory base
or None if base
is not a parent of file
. If file
or base
are not absolute, they are first resolved against the current working directory.
Attributes
Returns the relative file for file
relative to directory base
or None if base
is not a parent of file
. If file
or base
are not absolute, they are first resolved against the current working directory.
Returns the relative file for file
relative to directory base
or None if base
is not a parent of file
. If file
or base
are not absolute, they are first resolved against the current working directory.
Attributes
Resolves f
against base
, which must be an absolute directory. The result is guaranteed to be absolute. If f
is absolute, it is returned without changes.
Resolves f
against base
, which must be an absolute directory. The result is guaranteed to be absolute. If f
is absolute, it is returned without changes.
Attributes
Updates the group owner of the file. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
Updates the group owner of the file. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
Attributes
Sets the modification time of the file argument, in milliseconds since the Unix epoch (January 1, 1970 UTC).
Sets the modification time of the file argument, in milliseconds since the Unix epoch (January 1, 1970 UTC).
If the specified file does not exist, this method will return false. It will return true if the file modification time was successfully changed.
The deprecated method setModifiedTime() has similar semantics, but will throw an exception if the file does not exist. Please refer to its documentation for additional details.
This method may not work correctly if mtime is negative.
Attributes
- See also
-
setModifiedTime
Updates the file owner. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
Updates the file owner. This operation requires underlying filesystem to support IO.hasFileOwnerAttributeView
.
Attributes
Updates permission of this file. This operation requires underlying filesystem to support IO.isPosix
.
Updates permission of this file. This operation requires underlying filesystem to support IO.isPosix
.
Value parameters
- permissions
-
Must be 9 character POSIX permission representation e.g. "rwxr-x---"
Attributes
Splits the given string into base and extension strings. If name
contains no period, the base string is the input string and the extension is the empty string. Otherwise, the base is the substring up until the last period (exclusive) and the extension is the substring after the last period.
Splits the given string into base and extension strings. If name
contains no period, the base string is the input string and the extension is the empty string. Otherwise, the base is the substring up until the last period (exclusive) and the extension is the substring after the last period.
For example, split("Build.scala") == ("Build", "scala")
Attributes
Move the provided files to a temporary location. If 'f' returns normally, delete the files. If 'f' throws an Exception, return the files to their original location.
Move the provided files to a temporary location. If 'f' returns normally, delete the files. If 'f' throws an Exception, return the files to their original location.
Attributes
Constructs a File corresponding to url
, which must have a scheme of file
. This method properly works around an issue with a simple conversion to URI and then to a File.
Constructs a File corresponding to url
, which must have a scheme of file
. This method properly works around an issue with a simple conversion to URI and then to a File.
On Windows this can accept the following patterns of URLs:
val u0 = new URL("file:C:\\Users\\foo/.sbt/preloaded")
, val u1 = new URL("file:/C:\\Users\\foo/.sbt/preloaded")
, val u2 = new URL("file://unc/Users/foo/.sbt/preloaded")
, val u3 = new URL("file:///C:\\Users\\foo/.sbt/preloaded")
, and val u4 = new URL("file:////unc/Users/foo/.sbt/preloaded")
.
Attributes
Converts the given File to a URI. If the File is relative, the URI is relative, unlike File.toURI
Converts the given File to a URI. If the File is relative, the URI is relative, unlike File.toURI
Attributes
Each input file in files
is created if it doesn't exist. If a file already exists, the last modified time is set to the current time. It is not guaranteed that all files will have the same last modified time after this call.
Each input file in files
is created if it doesn't exist. If a file already exists, the last modified time is set to the current time. It is not guaranteed that all files will have the same last modified time after this call.
Attributes
Creates a file at the given location if it doesn't exist. If the file already exists and setModified
is true, this method sets the last modified time to the current time.
Creates a file at the given location if it doesn't exist. If the file already exists and setModified
is true, this method sets the last modified time to the current time.
Attributes
Copies the contents of in
to out
.
Copies the contents of in
to out
.
Attributes
Copies the contents of the input file in
to the out
stream. The output stream is not closed by this method.
Copies the contents of the input file in
to the out
stream. The output stream is not closed by this method.
Attributes
Copies all bytes from the given input stream to the given File. The input stream is not closed by this method.
Copies all bytes from the given input stream to the given File. The input stream is not closed by this method.
Attributes
Copies all bytes from the given input stream to the given output stream. Neither stream is closed.
Copies all bytes from the given input stream to the given output stream. Neither stream is closed.
Attributes
Copies all bytes from the given input stream to the given output stream. The input stream is closed after the method completes.
Copies all bytes from the given input stream to the given output stream. The input stream is closed after the method completes.
Attributes
Creates a temporary directory and provides its location to the given function. The directory is deleted after the function returns if keepDirectory
is set to false.
Creates a temporary directory and provides its location to the given function. The directory is deleted after the function returns if keepDirectory
is set to false.
Attributes
Overload of withTemporaryDirectory
with keepDirectory
set to false.
Overload of withTemporaryDirectory
with keepDirectory
set to false.
Attributes
Creates a file in the default temporary directory, calls action
with the file, deletes the file if keepFile
is set to true, and returns the result of calling action
. The name of the file will begin with prefix
, which must be at least three characters long, and end with postfix
, which has no minimum length.
Creates a file in the default temporary directory, calls action
with the file, deletes the file if keepFile
is set to true, and returns the result of calling action
. The name of the file will begin with prefix
, which must be at least three characters long, and end with postfix
, which has no minimum length.
Attributes
Overload of withTemporaryFile
with keepFile
set to false.
Overload of withTemporaryFile
with keepFile
set to false.
Attributes
Writes content
to file
using charset
or UTF-8 if charset
is not explicitly specified. If append
is false
, the existing contents of file
are overwritten. If append
is true
, the new content
is appended to the existing contents. If file
or any parent directories do not exist, they are created.
Writes content
to file
using charset
or UTF-8 if charset
is not explicitly specified. If append
is false
, the existing contents of file
are overwritten. If append
is true
, the new content
is appended to the existing contents. If file
or any parent directories do not exist, they are created.
Attributes
Writes bytes
to file
, overwriting any existing content. If any parent directories do not exist, they are first created.
Writes bytes
to file
, overwriting any existing content. If any parent directories do not exist, they are first created.
Attributes
Writes properties
to the File to
, using label
as the comment on the first line. If any parent directories of to
do not exist, they are first created.
Writes properties
to the File to
, using label
as the comment on the first line. If any parent directories of to
do not exist, they are first created.
Attributes
Writes lines
to file
using the given charset
or UTF-8 if charset
is not explicitly specified. If append
is false
, the contents of the file are overwritten. If append
is true
, the lines are appended to the file. A newline is written after each line and NOT before the first line. If any parent directories of file
do not exist, they are first created.
Writes lines
to file
using the given charset
or UTF-8 if charset
is not explicitly specified. If append
is false
, the contents of the file are overwritten. If append
is true
, the lines are appended to the file. A newline is written after each line and NOT before the first line. If any parent directories of file
do not exist, they are first created.
Attributes
Writes lines
to writer
using writer
's println
method.
Writes lines
to writer
using writer
's println
method.
Attributes
Creates a zip file.
Creates a zip file.
Value parameters
- outputZip
-
The file to write the zip to.
- sources
-
The files to include in the zip file paired with the entry name in the zip. Only the pairs explicitly listed are included.
- time
-
static timestamp to use for all entries, if any.
Attributes
Deprecated methods
Returns the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
.
Returns the directory, Java module, or the JAR file containing the class file cl
. If the location cannot be determined or it is not a file, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
.
Attributes
- Deprecated
- true
Returns the directory, Java module, or the JAR file containing the class file for type T
(as determined by an implicit Manifest). If the location cannot be determined, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
.
Returns the directory, Java module, or the JAR file containing the class file for type T
(as determined by an implicit Manifest). If the location cannot be determined, an error is generated. Note that for JDK 11 onwards, the returned module path cannot be expressed as File
.
Attributes
- Deprecated
- true
Copies the last modification time of fromFile
to toFile
, with a highest precision possible, by using native code when available.
Copies the last modification time of fromFile
to toFile
, with a highest precision possible, by using native code when available.
This method copies the timestamps with the highest possible precision offered by the native calls of this system for the filesystem in use. That could be in the region of nanoseconds. It is therefore more precise than using separate getModifiedTime()/setModifiedTime() calls, which will round timestamps to whole milliseconds.
If the timestamp cannot be copied, this method will throw a FileNotFoundException or an IOException, as appropriate.
This method was added in sbt/io v1.1.2, but it may be replaced in the future by a similar method that returns a Try, rather than throwing an exception. It is therefore marked as deprecated, since we cannot guarantee that it will remain available in future versions.
Attributes
- See also
-
getModifiedTime
setModifiedTime
- Deprecated
- true
Return the last modification timestamp of the specified file, in milliseconds since the Unix epoch (January 1, 1970 UTC). This method will use whenever possible native code in order to return a timestamp with a 1-millisecond precision.
Return the last modification timestamp of the specified file, in milliseconds since the Unix epoch (January 1, 1970 UTC). This method will use whenever possible native code in order to return a timestamp with a 1-millisecond precision.
This is in contrast to lastModified() in java.io.File, and to getLastModifiedTime() in java.nio.file.Files, which on many implementations of the JDK prior to JDK 10 will return timestamps with 1-second precision.
If native code support is not available for the JDK/OS in use, this method will revert to the Java calls. Currently supported systems are Linux 64/32 bits, Windows, and OSX, all on Intel hardware.
Please note that even on those platforms, not all filesystems support sub-second timestamp resolutions. For instance, ext2/3, FAT, and HFS+ all have a one second resolution or higher for modification times. Conversely, ext4, NTFS, and APFS all support at least millisecond resolution, or finer.
If the file does not exist, or if it impossible to obtain the modification time because of access permissions of other reasons, this method will throw a FileNotFoundException or an IOException, as appropriate. This is the same behavior as the nio code in Files.getLastModifiedTime(). However note that, in contrast, Java's traditional lastModified() in java.io.File will return zero if an error occurs.
If you do not wish to use native calls, please define the property "sbt.io.jdktimestamps" to "true" (or anything other than "false"), and Java's get/setLastModifiedTime() will be used instead. This setting applies to setModifiedTime() and copyModifiedTime() as well.
This method was added in sbt/io v1.1.2, but it may be replaced in the future by a similar method that returns a Try, rather than throwing an exception. It is therefore marked as deprecated, since we cannot guarantee that it will remain available in future versions.
Attributes
- See also
-
setModifiedTime
copyModifiedTime
- Deprecated
- true
Attributes
- Deprecated
- true
Sets the modification time of the file argument, in milliseconds since the Unix epoch (January 1, 1970 UTC). This method will use native code whenever possible in order to achieve a subsecond precision. Please see getModifiedTime() for further information. If it is impossible to set the modification time, the code will throw a FileNotFoundException or an IOException, as appropriate. This is similar to Files.setLastModifiedTime(). Note that, in contrast, Java's traditional setLastModified() will return a boolean false value if an error occurs.
Sets the modification time of the file argument, in milliseconds since the Unix epoch (January 1, 1970 UTC). This method will use native code whenever possible in order to achieve a subsecond precision. Please see getModifiedTime() for further information. If it is impossible to set the modification time, the code will throw a FileNotFoundException or an IOException, as appropriate. This is similar to Files.setLastModifiedTime(). Note that, in contrast, Java's traditional setLastModified() will return a boolean false value if an error occurs.
This method may not work correctly if mtime is negative.
This method was added in sbt/io v1.1.2, but it may be replaced in the future by a similar method that returns a Try, rather than throwing an exception. It is therefore marked as deprecated, since we cannot guarantee that it will remain available in future versions.
Attributes
- See also
-
getModifiedTime
copyModifiedTime
- Deprecated
- true
Attributes
- Deprecated
- true
Concrete fields
The newline string for this system, as obtained by the line.separator system property.
The newline string for this system, as obtained by the line.separator system property.
Attributes
Returns true
if the filesystem supports ACL file attribute view.
Returns true
if the filesystem supports ACL file attribute view.
Attributes
Returns true
if the filesystem supports basic file attribute view.
Returns true
if the filesystem supports basic file attribute view.
Attributes
Returns true
if the filesystem supports DOS file attribute view.
Returns true
if the filesystem supports DOS file attribute view.
Attributes
Returns true
if the filesystem supports file owner attribute view.
Returns true
if the filesystem supports file owner attribute view.
Attributes
Returns true
if the filesystem supports POSIX file attribute view.
Returns true
if the filesystem supports POSIX file attribute view.
Attributes
Returns true
if the filesystem supports user-defined file attribute view.
Returns true
if the filesystem supports user-defined file attribute view.