forked from MichaelRocks/libphonenumber-android
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
230 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
libphonenumber/src/commonMain/kotlin/io/michaelrocks/libphonenumber/kotlin/io/InputStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
package io.michaelrocks.libphonenumber.kotlin.io | ||
|
||
expect abstract class InputStream: AutoCloseable { | ||
abstract override fun close(): kotlin.Unit | ||
} | ||
interface InputStream : AutoCloseable | ||
|
22 changes: 4 additions & 18 deletions
22
...umber/src/commonMain/kotlin/io/michaelrocks/libphonenumber/kotlin/io/ObjectInputStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,6 @@ | ||
package io.michaelrocks.libphonenumber.kotlin.io | ||
|
||
expect open class ObjectInputStream(inputStream: InputStream) : InputStream, ObjectInput, ObjectStreamConstants { | ||
override fun readFully(b: ByteArray?): Unit | ||
override fun readFully(b: ByteArray?, off: Int, len: Int): Unit | ||
override fun skipBytes(n: Int): Int | ||
override fun readBoolean(): Boolean | ||
override fun readByte(): Byte | ||
override fun readUnsignedByte(): Int | ||
override fun readShort(): Short | ||
override fun readUnsignedShort(): Int | ||
override fun readChar(): Char | ||
override fun readInt(): Int | ||
override fun readLong(): Long | ||
override fun readFloat(): Float | ||
override fun readDouble(): Double | ||
override fun readLine(): String | ||
override fun readUTF(): String | ||
override fun close() | ||
} | ||
interface ObjectInputStream : InputStream, ObjectInput, ObjectStreamConstants | ||
|
||
|
||
expect fun getPlatformObjectInputStream(inputStream: InputStream): ObjectInputStream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
...er/src/jvmCommonMain/kotlin/io/michaelrocks/libphonenumber/kotlin/io/AutoCloseable.jvm.kt
This file was deleted.
Oops, something went wrong.
7 changes: 6 additions & 1 deletion
7
...mber/src/jvmCommonMain/kotlin/io/michaelrocks/libphonenumber/kotlin/io/InputStream.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
package io.michaelrocks.libphonenumber.kotlin.io | ||
|
||
actual typealias InputStream = java.io.InputStream | ||
class JavaInputStream(val javaInputStream: java.io.InputStream) : InputStream { | ||
|
||
override fun close() { | ||
javaInputStream.close() | ||
} | ||
} |
95 changes: 94 additions & 1 deletion
95
...rc/jvmCommonMain/kotlin/io/michaelrocks/libphonenumber/kotlin/io/ObjectInputStream.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,96 @@ | ||
package io.michaelrocks.libphonenumber.kotlin.io | ||
|
||
actual typealias ObjectInputStream = java.io.ObjectInputStream | ||
|
||
actual fun getPlatformObjectInputStream(inputStream: InputStream): ObjectInputStream { | ||
return JavaObjectInputStream(java.io.ObjectInputStream((inputStream as JavaInputStream).javaInputStream)) | ||
} | ||
|
||
class JavaObjectInputStream(val objectInputStream: java.io.ObjectInputStream) : ObjectInputStream { | ||
override fun readObject(): Any? { | ||
return objectInputStream.readObject() | ||
} | ||
|
||
override fun read(): Int { | ||
return objectInputStream.read() | ||
} | ||
|
||
override fun read(b: ByteArray?): Int { | ||
return objectInputStream.read(b) | ||
} | ||
|
||
override fun read(b: ByteArray?, off: Int, len: Int): Int { | ||
return objectInputStream.read(b, off, len) | ||
} | ||
|
||
override fun skip(n: Long): Long { | ||
return objectInputStream.skip(n) | ||
} | ||
|
||
override fun available(): Int { | ||
return objectInputStream.available() | ||
} | ||
|
||
override fun close() { | ||
objectInputStream.close() | ||
} | ||
|
||
override fun readFully(b: ByteArray?) { | ||
objectInputStream.readFully(b) | ||
} | ||
|
||
override fun readFully(b: ByteArray?, off: Int, len: Int) { | ||
objectInputStream.readFully(b, off, len) | ||
} | ||
|
||
override fun skipBytes(n: Int): Int { | ||
return objectInputStream.skipBytes(n) | ||
} | ||
|
||
override fun readBoolean(): Boolean { | ||
return objectInputStream.readBoolean() | ||
} | ||
|
||
override fun readByte(): Byte { | ||
return objectInputStream.readByte() | ||
} | ||
|
||
override fun readUnsignedByte(): Int { | ||
return objectInputStream.readUnsignedByte() | ||
} | ||
|
||
override fun readShort(): Short { | ||
return objectInputStream.readShort() | ||
} | ||
|
||
override fun readUnsignedShort(): Int { | ||
return objectInputStream.readUnsignedShort() | ||
} | ||
|
||
override fun readChar(): Char { | ||
return objectInputStream.readChar() | ||
} | ||
|
||
override fun readInt(): Int { | ||
return objectInputStream.readInt() | ||
} | ||
|
||
override fun readLong(): Long { | ||
return objectInputStream.readLong() | ||
} | ||
|
||
override fun readFloat(): Float { | ||
return objectInputStream.readFloat() | ||
} | ||
|
||
override fun readDouble(): Double { | ||
return objectInputStream.readDouble() | ||
} | ||
|
||
override fun readLine(): String? { | ||
return objectInputStream.readLine() | ||
} | ||
|
||
override fun readUTF(): String? { | ||
return objectInputStream.readUTF() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.