-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
json, msgpack (feature): Scala Native support (#3505)
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
airframe-msgpack/.native/src/main/scala-3/wvlet/airframe/msgpack/Compat.scala
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package wvlet.airframe.msgpack.spi | ||
import java.io.{InputStream, OutputStream} | ||
|
||
import wvlet.airframe.msgpack.impl.{PureScalaBufferPacker, PureScalaBufferUnpacker} | ||
import wvlet.airframe.msgpack.io.ByteArrayBuffer | ||
|
||
/** | ||
* Compatibility layer for Scala.js | ||
*/ | ||
object Compat: | ||
def isScalaJS = false | ||
|
||
def floatToIntBits(v: Float): Int = java.lang.Float.floatToIntBits(v) | ||
def doubleToLongBits(v: Double): Long = java.lang.Double.doubleToLongBits(v) | ||
|
||
def newBufferPacker: BufferPacker = | ||
new PureScalaBufferPacker | ||
def newPacker(out: OutputStream): Packer = ??? | ||
def newUnpacker(in: InputStream): Unpacker = ??? | ||
def newUnpacker(msgpack: Array[Byte]): Unpacker = | ||
newUnpacker(msgpack, 0, msgpack.length) | ||
def newUnpacker(msgpack: Array[Byte], offset: Int, len: Int): Unpacker = | ||
new PureScalaBufferUnpacker(ByteArrayBuffer.fromArray(msgpack, offset, len)) |
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