Some improvements for Java interoperability

This commit is contained in:
Christian Basler 2017-07-08 19:53:29 +02:00
parent 0478431c9c
commit 1a33f744d6
3 changed files with 4 additions and 1 deletions

View File

@ -68,11 +68,13 @@ open class CustomMessage(val customCommand: String, private val data: ByteArray?
companion object { companion object {
val COMMAND_ERROR = "ERROR" val COMMAND_ERROR = "ERROR"
@JvmStatic
fun read(`in`: InputStream, length: Int): CustomMessage { fun read(`in`: InputStream, length: Int): CustomMessage {
val counter = AccessCounter() val counter = AccessCounter()
return CustomMessage(varString(`in`, counter), bytes(`in`, length - counter.length())) return CustomMessage(varString(`in`, counter), bytes(`in`, length - counter.length()))
} }
@JvmStatic
fun error(message: String): CustomMessage { fun error(message: String): CustomMessage {
return CustomMessage(COMMAND_ERROR, message.toByteArray(charset("UTF-8"))) return CustomMessage(COMMAND_ERROR, message.toByteArray(charset("UTF-8")))
} }

View File

@ -77,6 +77,7 @@ data class ProofOfWorkRequest @JvmOverloads constructor(val sender: BitmessageAd
} }
companion object { companion object {
@JvmStatic
fun read(client: BitmessageAddress, `in`: InputStream): ProofOfWorkRequest { fun read(client: BitmessageAddress, `in`: InputStream): ProofOfWorkRequest {
return ProofOfWorkRequest( return ProofOfWorkRequest(
client, client,

View File

@ -23,7 +23,7 @@ import java.sql.PreparedStatement
/** /**
* Helper class that does Flyway migration, provides JDBC connections and some helper methods. * Helper class that does Flyway migration, provides JDBC connections and some helper methods.
*/ */
abstract class JdbcHelper protected constructor(protected val config: JdbcConfig) { abstract class JdbcHelper protected constructor(@JvmField protected val config: JdbcConfig) {
companion object { companion object {
@JvmStatic fun writeBlob(ps: PreparedStatement, parameterIndex: Int, data: Streamable?) { @JvmStatic fun writeBlob(ps: PreparedStatement, parameterIndex: Int, data: Streamable?) {
if (data == null) { if (data == null) {