frostwire / frostwire-jlibtorrent

A swig Java interface for libtorrent by the makers of FrostWire. Develop libtorrent based apps with the joy of coding in Java.
http://www.frostwire.com
MIT License
444 stars 137 forks source link

Explanation needed #207

Closed AntonAleksandrov13 closed 5 years ago

AntonAleksandrov13 commented 5 years ago

In this file following line is present: for (int i = 0; i < numPieces / 2; i++) { tracker.setComplete(i, true); }

I would like some explanation what it actually does, since docs for this method are not present.

gubatron commented 5 years ago

simply tracks the piece as complete/incomplete:


private final boolean[] complete;

public void setComplete(int pieceIndex, boolean complete) {
        this.complete[pieceIndex] = complete;
}

As the name of the class implies "PieceTracker" it's just to track piece status.

Hope this helps.

ghost commented 4 years ago

@gubatron Suppose I am completely new to world of torrents, how should I go about learning how to use your library? Are there any resources that I can use for reference?

gubatron commented 4 years ago

You can take a look at the tests: https://github.com/frostwire/frostwire-jlibtorrent/tree/master/src/test/java/com/frostwire/jlibtorrent

The demos: https://github.com/frostwire/frostwire-jlibtorrent/tree/master/src/test/java/com/frostwire/jlibtorrent/demo

You can also take a look at frostwire's source code: https://github.com/frostwire/frostwire/tree/master/common/src/main/java/com/frostwire/bittorrent

And for all documentation on how libtorrent works, the libtorrent documentation is great https://libtorrent.org/reference.html