Skip to content

Commit

Permalink
Add flush() and close() to Sink and Source
Browse files Browse the repository at this point in the history
  • Loading branch information
Egorand committed Apr 4, 2019
1 parent 9d009c1 commit 6fe6a01
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 5 deletions.
8 changes: 8 additions & 0 deletions okio/js/src/main/kotlin/okio/Buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,13 @@ actual class Buffer : BufferedSource, BufferedSink {
byteCount: Int
): Boolean = throw UnsupportedOperationException()

actual override fun flush() {
throw UnsupportedOperationException()
}

actual override fun close() {
throw UnsupportedOperationException()
}

actual override fun timeout(): Timeout = throw UnsupportedOperationException()
}
4 changes: 4 additions & 0 deletions okio/js/src/main/kotlin/okio/Sink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ package okio
actual interface Sink {
actual fun write(source: Buffer, byteCount: Long)

actual fun flush()

actual fun timeout(): Timeout

actual fun close()
}
2 changes: 2 additions & 0 deletions okio/js/src/main/kotlin/okio/Source.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ actual interface Source {
actual fun read(sink: Buffer, byteCount: Long): Long

actual fun timeout(): Timeout

actual fun close()
}
4 changes: 2 additions & 2 deletions okio/jvm/src/main/java/okio/Buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1614,11 +1614,11 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel {
return true
}

override fun flush() {}
actual override fun flush() {}

override fun isOpen() = true

override fun close() {}
actual override fun close() {}

actual override fun timeout() = Timeout.NONE

Expand Down
4 changes: 2 additions & 2 deletions okio/jvm/src/main/java/okio/Sink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ actual interface Sink : Closeable, Flushable {

/** Pushes all buffered bytes to their final destination. */
@Throws(IOException::class)
override fun flush()
actual override fun flush()

/** Returns the timeout for this sink. */
actual fun timeout(): Timeout
Expand All @@ -63,5 +63,5 @@ actual interface Sink : Closeable, Flushable {
* sink. It is an error to write a closed sink. It is safe to close a sink more than once.
*/
@Throws(IOException::class)
override fun close()
actual override fun close()
}
2 changes: 1 addition & 1 deletion okio/jvm/src/main/java/okio/Source.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ actual interface Source : Closeable {
* closed source. It is safe to close a source more than once.
*/
@Throws(IOException::class)
override fun close()
actual override fun close()
}
8 changes: 8 additions & 0 deletions okio/native/src/main/kotlin/okio/Buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,13 @@ actual class Buffer : BufferedSource, BufferedSink {
byteCount: Int
): Boolean = throw UnsupportedOperationException()

actual override fun flush() {
throw UnsupportedOperationException()
}

actual override fun close() {
throw UnsupportedOperationException()
}

actual override fun timeout(): Timeout = throw UnsupportedOperationException()
}
4 changes: 4 additions & 0 deletions okio/native/src/main/kotlin/okio/Sink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ package okio
actual interface Sink {
actual fun write(source: Buffer, byteCount: Long)

actual fun flush()

actual fun timeout(): Timeout

actual fun close()
}
2 changes: 2 additions & 0 deletions okio/native/src/main/kotlin/okio/Source.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ actual interface Source {
actual fun read(sink: Buffer, byteCount: Long): Long

actual fun timeout(): Timeout

actual fun close()
}
4 changes: 4 additions & 0 deletions okio/src/main/kotlin/okio/Buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,9 @@ expect class Buffer : BufferedSource, BufferedSink {
byteCount: Int
): Boolean

override fun flush()

override fun close()

override fun timeout(): Timeout
}
4 changes: 4 additions & 0 deletions okio/src/main/kotlin/okio/Sink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ package okio
expect interface Sink {
fun write(source: Buffer, byteCount: Long)

fun flush()

fun timeout(): Timeout

fun close()
}
2 changes: 2 additions & 0 deletions okio/src/main/kotlin/okio/Source.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ expect interface Source {
fun read(sink: Buffer, byteCount: Long): Long

fun timeout(): Timeout

fun close()
}

0 comments on commit 6fe6a01

Please sign in to comment.