Skip to content

Commit

Permalink
New TorrentInfo constructor that takes byte array
Browse files Browse the repository at this point in the history
  • Loading branch information
gubatron committed Feb 28, 2015
1 parent 6f5283c commit 294a265
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/com/frostwire/jlibtorrent/TorrentInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
@aldenml

aldenml Feb 28, 2015

Collaborator

Try to consider the output in ec, and throw the corresponding exception

This comment has been minimized.

Copy link
@gubatron

gubatron Feb 28, 2015

Author Collaborator

I've yet to test the code better.
Thanks for the reminder.

this.ti = new torrent_info(lentry);
}

/**
* Load the torrent file and decode it inside the constructor, for convenience.
* <p/>
Expand Down

0 comments on commit 294a265

Please sign in to comment.