Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite Java code to Kotlin #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

package cz.blocshop.socketsforcordova;
package cz.blocshop.socketsforcordova

public interface Consumer<T> {
void accept(T t);
}
interface Consumer<T> {
fun accept(t: T)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
package cz.blocshop.socketsforcordova;
package cz.blocshop.socketsforcordova

import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.Level
import java.util.logging.Logger

public class Logging {
public static void Error(String klass, String message, Throwable t) {
Logger.getLogger(klass).log(Level.SEVERE, message, t);
}
object Logging {
fun error(klass: String, message: String, t: Throwable) {
Logger.getLogger(klass).log(Level.SEVERE, message, t)
}
}
37 changes: 0 additions & 37 deletions src/android/src/cz/blocshop/socketsforcordova/SocketAdapter.java

This file was deleted.

21 changes: 21 additions & 0 deletions src/android/src/cz/blocshop/socketsforcordova/SocketAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cz.blocshop.socketsforcordova

import org.apache.cordova.CallbackContext
import java.io.IOException
import java.net.SocketException

interface SocketAdapter {
fun open(host: String, port: Int, timeout: Int)
fun write(data: ByteArray, callbackContext: CallbackContext)
@Throws(IOException::class)
fun shutdownWrite()
@Throws(IOException::class)
fun close()
@Throws(SocketException::class)
fun setOptions(options: SocketAdapterOptions)
fun setOpenEventHandler(openEventHandler: Consumer<Void>)
fun setOpenErrorEventHandler(openErrorEventHandler: Consumer<String>)
fun setDataConsumer(dataConsumer: Consumer<ByteArray>)
fun setCloseEventHandler(closeEventHandler: Consumer<Boolean>)
fun setErrorEventHandler(errorEventHandler: Consumer<String>)
}
213 changes: 0 additions & 213 deletions src/android/src/cz/blocshop/socketsforcordova/SocketAdapterImpl.java

This file was deleted.

Loading