public class MetaInfo
extends java.lang.Object
コンストラクタ | 説明 |
---|---|
MetaInfo(java.io.InputStream in) |
Creates a new MetaInfo from the given InputStream.
|
MetaInfo(java.lang.String announce,
java.lang.String name,
java.lang.String name_utf8,
java.util.List<java.util.List<java.lang.String>> files,
java.util.List<java.lang.Long> lengths,
int piece_length,
byte[] piece_hashes,
long length,
boolean privateTorrent,
java.util.List<java.util.List<java.lang.String>> announce_list,
java.lang.String created_by) |
Called by Storage when creating a new torrent from local data
|
MetaInfo(java.util.Map<java.lang.String,BEValue> m) |
Creates a new MetaInfo from a Map of BEValues and the SHA1 over
the original bencoded info dictonary (this is a hack, we could
reconstruct the bencoded stream and recalculate the hash).
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
boolean |
checkPiece(int piece,
byte[] bs,
int off,
int length) |
Checks that the given piece has the same SHA1 hash as the given
byte array.
|
(package private) boolean |
checkPiece(PartialPiece pp) |
|
java.lang.String |
getAnnounce() |
Returns the string representing the URL of the tracker for this torrent.
|
java.util.List<java.util.List<java.lang.String>> |
getAnnounceList() |
Returns a list of lists of urls.
|
java.lang.String |
getComment() |
The comment string or null.
|
java.lang.String |
getCreatedBy() |
The created-by string or null.
|
long |
getCreationDate() |
The creation date (ms) or zero.
|
java.util.List<java.util.List<java.lang.String>> |
getFiles() |
Returns a list of lists of file name hierarchies or null if it is
a single name.
|
byte[] |
getInfoBytes() |
|
byte[] |
getInfoHash() |
Returns the original 20 byte SHA1 hash over the bencoded info map.
|
java.util.List<java.lang.Long> |
getLengths() |
Returns a list of Longs indication the size of the individual
files, or null if it is a single file.
|
java.lang.String |
getName() |
Returns the requested name for the file or toplevel directory.
|
static java.lang.String |
getNameAndInfoHash(java.io.InputStream in,
byte[] infoHashOut) |
Efficiently returns the name and the 20 byte SHA1 hash of the info dictionary in a torrent file
Caller must close stream.
|
(package private) byte[] |
getPieceHashes() |
Returns the piece hashes.
|
int |
getPieceLength(int piece) |
Return the length of a piece.
|
int |
getPieces() |
Returns the number of pieces.
|
byte[] |
getTorrentData() |
Called by servlet to save a new torrent file generated from local data
|
long |
getTotalLength() |
Returns the total length of the torrent in bytes.
|
boolean |
isPrivate() |
Is it a private torrent?
|
static void |
main(java.lang.String[] args) |
|
MetaInfo |
reannounce(java.lang.String announce) |
Creates a copy of this MetaInfo that shares everything except the
announce URL.
|
java.lang.String |
toString() |
MetaInfo(java.lang.String announce, java.lang.String name, java.lang.String name_utf8, java.util.List<java.util.List<java.lang.String>> files, java.util.List<java.lang.Long> lengths, int piece_length, byte[] piece_hashes, long length, boolean privateTorrent, java.util.List<java.util.List<java.lang.String>> announce_list, java.lang.String created_by)
announce
- may be nullfiles
- null for single-file torrentlengths
- null for single-file torrentannounce_list
- may be nullcreated_by
- may be nullpublic MetaInfo(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public MetaInfo(java.util.Map<java.lang.String,BEValue> m) throws InvalidBEncodingException
public static java.lang.String getNameAndInfoHash(java.io.InputStream in, byte[] infoHashOut) throws java.io.IOException
infoHashOut
- 20-byte out parameterjava.io.IOException
public java.lang.String getAnnounce()
public java.util.List<java.util.List<java.lang.String>> getAnnounceList()
public byte[] getInfoHash()
byte[] getPieceHashes()
public java.lang.String getName()
public boolean isPrivate()
public java.util.List<java.util.List<java.lang.String>> getFiles()
public java.util.List<java.lang.Long> getLengths()
public java.lang.String getComment()
public java.lang.String getCreatedBy()
public long getCreationDate()
public int getPieces()
public int getPieceLength(int piece)
getPieces()-1
).java.lang.IndexOutOfBoundsException
- when piece is equal to or
greater then the number of pieces in the torrent.public boolean checkPiece(int piece, byte[] bs, int off, int length)
boolean checkPiece(PartialPiece pp)
public long getTotalLength()
public java.lang.String toString()
toString
クラス内 java.lang.Object
public MetaInfo reannounce(java.lang.String announce) throws InvalidBEncodingException
announce
- may be nullInvalidBEncodingException
public byte[] getTorrentData()
public byte[] getInfoBytes()
public static void main(java.lang.String[] args)