Comments (2)
Hi @rpithadia25, TorrentBuilder
was meant to address the simple cases with a fluent api. Here I added a verbatim copy of a test in libtorrent
for a v2
only #183, something similar can be done for hybrid.
error_code ec = new error_code();
file_storage fs = new file_storage();
fs.add_file_ex(ec, "test/A", 0x8002);
fs.add_file_ex(ec, "test/B", 0x4002);
create_torrent t = new create_torrent(fs, 0x4000, create_torrent.v2_only);
t.set_hash2(0, 0, sha256_hash.max());
t.set_hash2(0, 1, sha256_hash.max());
t.set_hash2(0, 2, sha256_hash.max());
// file 1 is a pad file
t.set_hash2(2, 0, sha256_hash.max());
t.set_hash2(2, 1, sha256_hash.max());
byte[] buffer = Vectors.byte_vector2bytes(t.generate().bencode());
torrent_info info = TorrentInfo.bdecode(buffer).swig();
assertTrue(info.info_hashes().has_v2());
assertFalse(info.info_hashes().has_v1());
assertEquals("A", info.files().file_name_ex(0));
assertTrue(info.files().pad_file_at(1));
assertEquals("B", info.files().file_name_ex(2));
assertEquals("test", info.name());
create_torrent t2 = new create_torrent(info);
byte[] buffer2 = Vectors.byte_vector2bytes(t2.generate().bencode());
assertArrayEquals(buffer, buffer2);
let me know if there is another specific case I can help with.
from libtorrent4j.
Thanks a lot for the quick response. I'll try this out.
from libtorrent4j.
Related Issues (20)
- Nothing compiles HOT 2
- 为什么我设置Priority不生效 HOT 2
- Start a task with Resume file take too much time HOT 4
- TorrentInfo Incomplete HOT 1
- Info about the docs HOT 1
- Libtorrent
- Magnet resume data doesn't contain trackers and url seeds HOT 8
- Does anyone has WebTorrent working? HOT 9
- Piece Priority behaves erratically HOT 1
- Support for Raspberry Pi HOT 5
- Support for BEP 53 - Select specific files indices for download. HOT 1
- java: package org.libtorrent4j does not exist HOT 2
- No libtorrent4j in java.library.path
- AddTorrentParams getTrackers() returns empty list
- [Android] Fatal Exception: java.lang.LinkageError
- Fetch v2 Magnet failed HOT 2
- Please migrate your websites to cloudflare-pages [FREE HOSTING] HOT 2
- Crash on docker alpine image HOT 1
- Support for Linux ARM64?
- Linking error : no torrent4j in java.library.path HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libtorrent4j.