-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
64 lines (52 loc) · 3.63 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>scodec - Home</title>
<link rel="stylesheet" href="/stylesheet.css">
<link rel="stylesheet" href="/pygments.css">
<meta name="generator" content="nanoc 4.9.9">
</head>
<body>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41236326-2', 'auto');
ga('send', 'pageview');
</script>
<div id="main">
<h1 id="scodec">scodec</h1>
<p>scodec is a suite of Scala libraries for working with binary data. Support ranges from simple, performant data structures for working with bits and bytes to streaming encoding and decoding.</p>
<pre><code class="language-scala"><span class="k">import</span> <span class="nn">scodec.bits._</span>
<span class="k">val</span> <span class="n">otp</span> <span class="k">=</span> <span class="n">hex</span><span class="s">"54686973206973206e6f74206120676f6f642070616420746f2075736521"</span><span class="o">.</span><span class="n">bits</span>
<span class="c1">// otp: scodec.bits.BitVector = BitVector(240 bits, 0x54686973206973206e6f74206120676f6f642070616420746f2075736521)</span>
<span class="k">val</span> <span class="n">bits</span> <span class="k">=</span> <span class="n">hex</span><span class="s">"746be39ece241e0da28b7acd4fad63632249ec5e2e402d5a0b2cd95d0a05"</span><span class="o">.</span><span class="n">bits</span>
<span class="c1">// bits: scodec.bits.BitVector = BitVector(240 bits, 0x746be39ece241e0da28b7acd4fad63632249ec5e2e402d5a0b2cd95d0a05)</span>
<span class="k">val</span> <span class="n">decoded</span> <span class="k">=</span> <span class="o">(</span><span class="n">bits</span> <span class="o">^</span> <span class="n">otp</span><span class="o">)</span> <span class="n">rotateLeft</span> <span class="mi">3</span>
<span class="c1">// decoded: scodec.bits.BitVector = BitVector(240 bits, 0x001c576f726b696e6720776974682062696e617279206973206561737921)</span>
<span class="k">import</span> <span class="nn">scodec.codecs._</span>
<span class="k">val</span> <span class="n">msg</span> <span class="k">=</span> <span class="n">variableSizeBytes</span><span class="o">(</span><span class="n">uint16</span><span class="o">,</span> <span class="n">utf8</span><span class="o">).</span><span class="n">decode</span><span class="o">(</span><span class="n">decoded</span><span class="o">).</span><span class="n">require</span><span class="o">.</span><span class="n">value</span>
<span class="c1">//msg: String = Working with binary is easy!</span></code></pre>
<p>See the documentation for more information or get in touch via the mailing list, StackOverflow, or Twitter.</p>
</div>
<div id="sidebar">
<img src="/scodec-logo.png" alt="logo" id="logo">
<h2>Documentation</h2>
<ul>
<li><a href="/guide">Guide</a></li>
<li><a href="/api">ScalaDoc</a></li>
<li><a href="/releases/">Releases</a></li>
</ul>
<h2>Community</h2>
<ul>
<li><a href="https://github.com/scodec/">GitHub</a></li>
<li><a href="https://gitter.im/scodec/scodec">Chat</a></li>
<li><a href="https://groups.google.com/group/scodec/">Mailing List</a></li>
<li><a href="https://twitter.com/search?q=scodec&src=sprv">Twitter</a></li>
<li><a href="http://stackoverflow.com/questions/tagged/scodec">StackOverflow</a></li>
</ul>
</div>
</body>
</html>