net.sf.torrentsniffer.bencoding
Class BencodingImpl

java.lang.Object
  extended bynet.sf.torrentsniffer.bencoding.BencodingImpl
All Implemented Interfaces:
Bencoding

public class BencodingImpl
extends java.lang.Object
implements Bencoding

Implementation of bencoding. See http://wiki.theory.org/index.php/BitTorrentSpecification for information about bencoding.

Author:
Larry Williams

Field Summary
static java.lang.String BYTE_ENCODING
           
 
Constructor Summary
BencodingImpl()
           
 
Method Summary
 Dictionary decode(java.io.InputStream input)
          Decodes the bencoded data in a stream.
 Dictionary decode(java.lang.String string)
          Decodes the bencoded data in a torrent file.
 Dictionary decode(java.net.URL url)
          Decodes the bencoded data in a URL.
 void encode(java.io.OutputStream out, java.lang.Object object)
          Encodes a graph of objects.
 boolean match(Dictionary bencoded1, Dictionary bencoded2)
          Checks if two bencoded Dictionaries are the same.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE_ENCODING

public static final java.lang.String BYTE_ENCODING
See Also:
Constant Field Values
Constructor Detail

BencodingImpl

public BencodingImpl()
Method Detail

decode

public Dictionary decode(java.lang.String string)
                  throws java.io.FileNotFoundException
Description copied from interface: Bencoding
Decodes the bencoded data in a torrent file.

Specified by:
decode in interface Bencoding
Parameters:
string -
Returns:
Throws:
java.io.FileNotFoundException

decode

public Dictionary decode(java.io.InputStream input)
Description copied from interface: Bencoding
Decodes the bencoded data in a stream.

Specified by:
decode in interface Bencoding
Parameters:
input -
Returns:

decode

public Dictionary decode(java.net.URL url)
Description copied from interface: Bencoding
Decodes the bencoded data in a URL.

Specified by:
decode in interface Bencoding
Parameters:
url -
Returns:
See Also:
net.sf.torrentsniff.bencoding.Bencoding#decode(java.net.URL)

encode

public void encode(java.io.OutputStream out,
                   java.lang.Object object)
Description copied from interface: Bencoding
Encodes a graph of objects.

Specified by:
encode in interface Bencoding
Parameters:
object -
out -
Returns:

match

public boolean match(Dictionary bencoded1,
                     Dictionary bencoded2)
Description copied from interface: Bencoding
Checks if two bencoded Dictionaries are the same. Assuming a bencoded file always starts with a Dictionary.

Specified by:
match in interface Bencoding
Returns:


Copyright © 2004 Larry Williams. All Rights Reserved.