Skip to content

Commit

Permalink
Merge pull request square#881 from square/jwilson.0109.read_write
Browse files Browse the repository at this point in the history
Add missing exceptions to FileSystem.write and read
  • Loading branch information
swankjesse authored Jan 10, 2021
2 parents e5bd0ad + bc4fdff commit 9db4923
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions okio/src/commonMain/kotlin/okio/FileSystem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ abstract class FileSystem {
* Creates a source to read [file], executes [readerAction] to read it, and then closes the
* source. This is a compact way to read the contents of a file.
*/
@Throws(IOException::class)
inline fun <T> read(file: Path, readerAction: BufferedSource.() -> T): T {
return source(file).buffer().use {
it.readerAction()
Expand All @@ -178,6 +179,7 @@ abstract class FileSystem {
* Creates a sink to write [file], executes [writerAction] to write it, and then closes the sink.
* This is a compact way to write a file.
*/
@Throws(IOException::class)
inline fun <T> write(file: Path, writerAction: BufferedSink.() -> T): T {
return sink(file).buffer().use {
it.writerAction()
Expand Down

0 comments on commit 9db4923

Please sign in to comment.