Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andresilva/bytes
Fast, typesafe and boilerplate-free object serialization in Scala
https://github.com/andresilva/bytes
Last synced: 12 days ago
JSON representation
Fast, typesafe and boilerplate-free object serialization in Scala
- Host: GitHub
- URL: https://github.com/andresilva/bytes
- Owner: andresilva
- License: mit
- Created: 2014-05-15T22:32:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-06T11:49:07.000Z (over 10 years ago)
- Last Synced: 2024-12-20T22:05:43.234Z (13 days ago)
- Language: Scala
- Homepage:
- Size: 934 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
bytes
=====A playground for fast, typesafe and boilerplate-free object serialization in Scala.
This is what we've got so far:
```scala
import io.github.andrebeat.bytes._case class Foo(
b: Byte,
s: Short,
c: Char,
i: Int,
f: Float,
l: Long,
d: Double,
is: List[Int],
set: Set[Char],
map: Map[Long, Int],
opt: Option[Float],
either: Either[Byte, Int])val foo = Foo(
1, 42, '?', 13231, 9023.0f, 55554434L, 321.0,
1 :: 2 :: 3 :: Nil,
Set('a', 'b', 'c'),
Map(99L -> 0, 98L -> 1),
None,
Right(4))val bytes: Bytes = UnsafeBytes(1024)
Write(bytes, 0, foo)
// res0: Int = 83val (foo2, size) = Read[Foo](bytes, 0)
// foo2: Foo = Foo(1,42,?,13231,9023.0,55554434,321.0,List(1, 2, 3),Set(a, b, c),Map(99 -> 0, 98 -> 1),None,Right(4))
// size: Int = 83
```