-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New TorrentInfo constructor that takes byte array
- Loading branch information
Showing
1 changed file
with
7 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -20,6 +20,13 @@ public TorrentInfo(torrent_info ti) { | |
this.ti = ti; | ||
} | ||
|
||
public TorrentInfo(byte[] bencodedBytes) { | ||
lazy_entry lentry = new lazy_entry(); | ||
error_code ec = new error_code(); | ||
lazy_entry.bdecode(Vectors.bytes2char_vector(bencodedBytes), lentry, ec); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gubatron
Author
Collaborator
|
||
this.ti = new torrent_info(lentry); | ||
} | ||
|
||
/** | ||
* Load the torrent file and decode it inside the constructor, for convenience. | ||
* <p/> | ||
|
Try to consider the output in ec, and throw the corresponding exception