Package org.johnnei.javatorrent.torrent
Class TorrentFileSet
- java.lang.Object
-
- org.johnnei.javatorrent.torrent.AbstractFileSet
-
- org.johnnei.javatorrent.torrent.TorrentFileSet
-
public class TorrentFileSet extends AbstractFileSet
-
-
Field Summary
-
Fields inherited from class org.johnnei.javatorrent.torrent.AbstractFileSet
fileInfos, pieces
-
-
Constructor Summary
Constructors Constructor Description TorrentFileSet(Metadata metadata, File downloadFolder)Creates a TorrentFileSet instance based upon a .torrent file
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getBitfieldBytes()Gets the have pieces in bitfield format as specified by BEP #3.FilegetDownloadFolder()longgetPieceSize()Gets the default piece sizeorg.johnnei.javatorrent.internal.torrent.TorrentFileSetRequestFactorygetRequestFactory()voidsetHavingPiece(int pieceIndex)Marks a piece as completed.-
Methods inherited from class org.johnnei.javatorrent.torrent.AbstractFileSet
countCompletedPieces, countRemainingBytes, getBlockSize, getFileForBytes, getFiles, getNeededPieces, getPiece, getPieceCount, getTotalFileSize, hasPiece, isDone
-
-
-
-
Constructor Detail
-
TorrentFileSet
public TorrentFileSet(Metadata metadata, File downloadFolder)
Creates a TorrentFileSet instance based upon a .torrent file- Parameters:
metadata- The metadata containing the torrent informationdownloadFolder- The folder in which the downloads need to be stored.- Throws:
IllegalArgumentException- When the torrent file is missing or incomplete.
-
-
Method Detail
-
setHavingPiece
public void setHavingPiece(int pieceIndex)
Description copied from class:AbstractFileSetMarks a piece as completed.- Overrides:
setHavingPiecein classAbstractFileSet- Parameters:
pieceIndex- the index of the piece
-
getPieceSize
public long getPieceSize()
Gets the default piece size- Specified by:
getPieceSizein classAbstractFileSet- Returns:
- The default piece size
-
getBitfieldBytes
public byte[] getBitfieldBytes()
Description copied from class:AbstractFileSetGets the have pieces in bitfield format as specified by BEP #3.- Specified by:
getBitfieldBytesin classAbstractFileSet- Returns:
- The bitfield associated with this fileset.
-
getRequestFactory
public org.johnnei.javatorrent.internal.torrent.TorrentFileSetRequestFactory getRequestFactory()
- Specified by:
getRequestFactoryin classAbstractFileSet- Returns:
- The request factory which can create requests for this
AbstractFileSet.
-
getDownloadFolder
public File getDownloadFolder()
-
-