File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ Reference: [https://www.bittorrent.org/beps/bep_0003.html](https://www.bittorren
99## Usage
1010
1111Add the dependency to your ` build.gradle.kts `
12+
1213``` kotlin
13- dependencies{
14+ dependencies {
1415 implementation(" space.iseki.bencoding:kotlinx-serialization-bencoding:0.1.+" )
1516}
1617```
@@ -24,3 +25,20 @@ fun foo(input: InputStream) {
2425}
2526```
2627
28+ ## Bencoding Format
29+
30+ The following content is copied
31+ from [ https://www.bittorrent.org/beps/bep_0003.html ] ( https://www.bittorrent.org/beps/bep_0003.html ) for a memo.
32+
33+ - Strings are length-prefixed base ten followed by a colon and the string. For example ` 4:spam ` corresponds to 'spam'.
34+ - Integers are represented by an 'i' followed by the number in base 10 followed by an 'e'. For example ` i3e ` corresponds
35+ to 3 and ` i-3e ` corresponds to -3. Integers have no size limitation. ` i-0e ` is invalid. All encodings with a leading
36+ zero,
37+ such as ` i03e ` , are invalid, other than i0e, which of course corresponds to 0.
38+ - Lists are encoded as an 'l' followed by their elements (also bencoded) followed by an 'e'. For
39+ example ` l4:spam4:eggse `
40+ corresponds to [ 'spam', 'eggs'] .
41+ - Dictionaries are encoded as a 'd' followed by a list of alternating keys and their corresponding values followed by
42+ an 'e'. For example, ` d3:cow3:moo4:spam4:eggse ` corresponds to {'cow': 'moo', 'spam': 'eggs'} and ` d4:spaml1:a1:bee `
43+ corresponds to {'spam': [ 'a', 'b'] }. Keys must be strings and appear in sorted order (sorted as raw strings, not
44+ alphanumerics).
You can’t perform that action at this time.
0 commit comments