Skip to content

Commit

Permalink
Extract Sink, Source, BufferedSink and BufferedSource into common as …
Browse files Browse the repository at this point in the history
…marker interfaces
  • Loading branch information
Egorand committed Apr 4, 2019
1 parent d4fe091 commit ddf8023
Show file tree
Hide file tree
Showing 16 changed files with 232 additions and 4 deletions.
19 changes: 19 additions & 0 deletions okio/js/src/main/kotlin/okio/BufferedSink.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface BufferedSink : Sink
19 changes: 19 additions & 0 deletions okio/js/src/main/kotlin/okio/BufferedSource.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface BufferedSource : Source
19 changes: 19 additions & 0 deletions okio/js/src/main/kotlin/okio/Sink.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface Sink
19 changes: 19 additions & 0 deletions okio/js/src/main/kotlin/okio/Source.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface Source
2 changes: 1 addition & 1 deletion okio/jvm/src/main/java/okio/BufferedSink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import java.nio.charset.Charset
* A sink that keeps a buffer internally so that callers can do small writes without a performance
* penalty.
*/
interface BufferedSink : Sink, WritableByteChannel {
actual interface BufferedSink : Sink, WritableByteChannel {
/** Returns this sink's internal buffer. */
@Deprecated(
message = "moved to val: use getBuffer() instead",
Expand Down
2 changes: 1 addition & 1 deletion okio/jvm/src/main/java/okio/BufferedSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import java.nio.charset.Charset
* penalty. It also allows clients to read ahead, buffering as much as necessary before consuming
* input.
*/
interface BufferedSource : Source, ReadableByteChannel {
actual interface BufferedSource : Source, ReadableByteChannel {
/** Returns this source's internal buffer. */
@Deprecated(
message = "moved to val: use getBuffer() instead",
Expand Down
2 changes: 1 addition & 1 deletion okio/jvm/src/main/java/okio/Sink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import java.io.IOException
* Use [sink] to adapt an `OutputStream` to a sink. Use [outputStream()][BufferedSink.outputStream]
* to adapt a sink to an `OutputStream`.
*/
interface Sink : Closeable, Flushable {
actual interface Sink : Closeable, Flushable {
/** Removes `byteCount` bytes from `source` and appends them to this. */
@Throws(IOException::class)
fun write(source: Buffer, byteCount: Long)
Expand Down
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 @@ -53,7 +53,7 @@ import java.io.IOException
* Use [source] to adapt an `InputStream` to a source. Use [BufferedSource.inputStream] to adapt a
* source to an `InputStream`.
*/
interface Source : Closeable {
actual interface Source : Closeable {
/**
* Removes at least 1, and up to `byteCount` bytes from this and appends them to `sink`. Returns
* the number of bytes read, or -1 if this source is exhausted.
Expand Down
19 changes: 19 additions & 0 deletions okio/native/src/main/kotlin/okio/BufferedSink.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface BufferedSink : Sink
19 changes: 19 additions & 0 deletions okio/native/src/main/kotlin/okio/BufferedSource.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface BufferedSource : Source
19 changes: 19 additions & 0 deletions okio/native/src/main/kotlin/okio/Sink.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface Sink
19 changes: 19 additions & 0 deletions okio/native/src/main/kotlin/okio/Source.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

actual interface Source
19 changes: 19 additions & 0 deletions okio/src/main/kotlin/okio/BufferedSink.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

expect interface BufferedSink : Sink
19 changes: 19 additions & 0 deletions okio/src/main/kotlin/okio/BufferedSource.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

expect interface BufferedSource : Source
19 changes: 19 additions & 0 deletions okio/src/main/kotlin/okio/Sink.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

expect interface Sink
19 changes: 19 additions & 0 deletions okio/src/main/kotlin/okio/Source.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2019 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package okio

expect interface Source

0 comments on commit ddf8023

Please sign in to comment.